| | |
mapserver : GMaps API and custom maps
![]() |
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
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
•
•
Join Date: Jul 2006
Posts: 19
Reputation:
Solved Threads: 1
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/
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/
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
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
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
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
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
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.
![]() |
Similar Threads
- SEO and AdWords API (Pay-Per-Click Advertising)
- Looking for website designer with google maps API background (Web Development Job Offers)
- Anyone work with a wicked cool PHP Calendar before (PHP)
- interactive maps? is this possible mambo/php (PHP)
Other Threads in the IT Professionals' Lounge Forum
- Previous Thread: Getting back in the game
- Next Thread: Desperate MIS Student NEEDS INTERNSHIP!
| Thread Tools | Search this Thread |
Tag cloud for IT Professionals' Lounge
1gbit advertising advice amazon archive british broadband business businessprocesses career carrier censorship cern china cio collectiveintelligence connectivity consumers corporateearnings css datatransfer debtcollectors dictionary digg digital ebay ecommerce email employment environment facebook food government grid high-definition hottub infodelivery infotech intel internet interview ipod isp japan kindle lhc library malware marketing mit news onlineshopping php piracy piratebay pope porn program questions r&d religion remoteworking research retail schools security sex shopping simple skype smallbusiness smb sms socialmedia socialnetworking software softwareengineer spam speed spending startrek statistics stocks study stumbleupon survey tabletpc technology touch-screen touchscreen training twitter uk vbulletin voips web webdesign webdeveloper windows words





