944,202 Members | Top Members by Rank

Ad:
Jul 6th, 2006
0

mapserver : GMaps API and custom maps

Expand Post »
Hi,

Wishes.

After finding it really difficult in getting kamaps + Mapserver up in the server, I thought of finding out a alternative and i made it out that i could use google API functions for my map system.

I would like to know whether or how i could load on default my map. I do not worry about the pan and zoom. I am worried about the redirection to my mapserver.

Anybody having any idea about this... would anyone like ot share with me your thoughts and advice....

Thanking you in advance i remain

Harish
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster
hbmarar is offline Offline
187 posts
since Apr 2005
Jul 6th, 2006
0

Re: mapserver : GMaps API and custom maps

You can sign up for a Google Maps API key here:
http://www.google.com/apis/maps/signup.html

Go here for a simple introduction:
http://www.google.com/apis/maps/docu...of_Google_Maps

I use this to get latitudes and longitudes (which you will use in the Google Map script):
http://geocoder.us/
Reputation Points: 10
Solved Threads: 1
Newbie Poster
b225ccc is offline Offline
19 posts
since Jul 2006
Jul 7th, 2006
0

Re: mapserver : GMaps API and custom maps

Hi b225ccc,

Thanks for the reply. Well, this is working fine. What i am trying ahead is and have got stuck is loading my own custom maps from my mapserver.

I would like to create my own mapType and add it to gmaps API maPTypes and use the same features and functionalites with my maps loaded. I had read article on custom maps but this is not working with mine.

I expected it to work without any thought and now i am stuck because of unexpected happened. It is not loading the maps i have in my map server folder. (

Any thoughts or idea with this? I would be greatful for your help and thanking you once again for the consideration and concern, I remain

Harish
Reputation Points: 10
Solved Threads: 0
Junior Poster
hbmarar is offline Offline
187 posts
since Apr 2005
Jul 7th, 2006
0

Re: mapserver : GMaps API and custom maps

Ok, unfortunately, what you're trying to do is beyond the scope of my experience with the Google maps API, so hopefully somebody else picks up the thread. Good luck.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
b225ccc is offline Offline
19 posts
since Jul 2006
Jul 7th, 2006
0

Re: mapserver : GMaps API and custom maps

Hi b255ccc,

First of all, thanks for your reply.I am posting the method that worked for some in brief here to carry this discussion with other people in the forums to help me get it out. Hope you too would find this informative when somebody really makes out how it could be done for this issue..

I have modified the body onload script initMap with the script in mapki. I am pasting the code as below..
-----------------------initmap script ------
map = new GMap(document.getElementById("map"));
//copy object function
function copy_obj(o){
var c = new Object();
for (var e in o)
{
c[e] = c [o];
}
return c;
}

//copy mapType

hbMapType = copy_obj(map.mapTypes[0];
//setting path to our map type

hbMapType.baseUrls = new Array();
hbMapType.baseUrls[0] = "http://tech2sol.com/scvmap/index.php? ";
hbMapType.lowResBaseUrls = new Array();
hbMapType.lowResBaseUrls[0] = " http://tech2sol.com/scvmap/index.php?";

hbMapType.getLinkText = function () {
return 'APPELATIONS';
}

map.mapTypes[map.mapTypes.Length] = hbMapType;

map.setMapType(map.MapTypes[map.mapTypes.length-1]);

map.addControl(new GMapTypeControl());
map.addControl(new GSmallZoomControl());

----------------------
index.php in scvmap folder
------------------------<?php
define("No_DATA", "./no_data.gif");
define("ZOOM_IN", "./zoom_in.gif");
define("ZOOM_OUT", ".zoom_out.gif");

$x = $_GET["x"];
$y = $_GET["y"];
$Z = $_GET["zoom"];

$filename = "./maptiles/${x}_{y}_{z}.gif";
if ( $z < 2){
$content = file_get_contents(ZOOM_OUT );
}else if ( $z > 5 ){
$content = file_get_contents( ZOOM_IN );
}else if (is_numeric($x) && is_numeric($y) && is_numeric($z) && file_exists($filename)){
$content = file_get_contents( $filename );
}else{
$content = file_get_contents( NO_DATA);
}

header("Content-type: image/gif");

//echo $content;
//get header send by the client.
$headers = emu_getallheaders();

// Checking if the client is validating his cache and if it is the current.
if(isset($headers['If-Modified-Since']) && (strtotime($headers['If-Modified-Since']) == filemtime ($filename))){
header('Last-Modified: '.gmdate('D, d m Y H:i:s', filemtime($filename)).' GMT', true,304);
} else {
//Winery maps not cached or cache outdated, we respond '200 OK' and output the image.
header('Last-Modified: 'gmdate('D, d m Y H:i:s', filemtime($filename)).' GMT', true, 200);
echo ($content);
}

function emu_getallheaders(){
foreach($_SERVER AS $h=>$v)
if(ereg('HTTP_(.+)',$h, $hp))
$headers[$hp[1]]=$v;
return headers;
}

?>
------------------------

I have a map image say australia.gif and australia.jpg.
My simple need is that i should be able to load this map instead of other maps. I used the automatic tile cutter and it gave me at zoom level 5 images like 1204_1204_5.gif. I am still now able to make out how this action of reloading is done though i understand the scripts. I read that 1204,1204,5 is send by google API on user click or event. But what i want now is a australia.gif as default laod image and pan and zoom feature. I am not able to do this simple enhancement as told in your threads nor in mapki...

What am i doin wrong? what should i correct? I request your help very sincerely and thanking you in advance for the request.Is the path in the index.php scvmap folder need to be corrected or i should note of anything here extra...

I know this is done by a few and only myself seems stuck with this.

regards

Harish
Reputation Points: 10
Solved Threads: 0
Junior Poster
hbmarar is offline Offline
187 posts
since Apr 2005
Jul 11th, 2006
0

Re: mapserver : GMaps API and custom maps

hi,

I am stuck at a javascript error stating that mapTypes has no properties defined. Anybody now how a new mapTYpe made by me could miss properties. Isnt it should also be inherited whne we create a new mapType from the gmap instance.

in the script console : i find the following errors
1.
Error: vBmenu.menus[this.id] has no properties
Source File: http://www.daniweb.com/techtalkforum...lletin_menu.js
Line: 623
2.
Error: map.MapTypes has no properties
Source File: http://127.0.0.1/hbt/vmaps&Itemid=31
Line: 228

Let me know further thoughts on this. Requesting the same.

Harish
Last edited by hbmarar; Jul 11th, 2006 at 9:16 am.
Reputation Points: 10
Solved Threads: 0
Junior Poster
hbmarar is offline Offline
187 posts
since Apr 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in IT Professionals' Lounge Forum Timeline: Getting back in the game
Next Thread in IT Professionals' Lounge Forum Timeline: Desperate MIS Student NEEDS INTERNSHIP!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC