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

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

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.

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) && (strtotime($headers) == 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

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/techtalkforums/clientscript/vbulletin_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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.