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


11 Years
Discussion Span
Last Post by hbmarar

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



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 () {

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


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

index.php in scvmap folder
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 );
$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))
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.



Edited by happygeek: fixed formatting



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
Error: vBmenu.menus[this.id] has no properties
Source File: http://www.daniweb.com/techtalkforums/clientscript/vbulletin_menu.js
Line: 623
Error: map.MapTypes has no properties
Source File:
Line: 228

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


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.