开发者

Making a Google Map with custom markers on maps.google.com

开发者 https://www.devze.com 2023-01-30 14:33 出处:网络
I\'m currently using the Google Maps v.3 API to generate a custom map of locations in my database on my site. Each location that turns up in the database query is given a marker and a 开发者_如何学Pyt

I'm currently using the Google Maps v.3 API to generate a custom map of locations in my database on my site. Each location that turns up in the database query is given a marker and a 开发者_如何学Pythonsimple Info Window that displays its name and address. However, I'd like to give users the option of also looking at the map on Google's site (maps.google.com) so that they can access driving directions there. Is there any way to do this? I was thinking something the along the lines of dynamically importing a GeoRSS feed, but I don't know if that's possible.


Users can click on the Google Logo on the bottom left hand side of the map to go to a standard google maps page.. alternatively can build up a URL from your map and send them off to a new page.. here's a function I use to give Users a URL that they can paste into other places.. you could use similar code with the window.open javascript function:

function GenerateLink(){
var url;
url = "http://maps.google.com/?ll=" + map.getCenter().lat() + "," + map.getCenter().lng() + '&z=' + map.getZoom(); 
prompt("You can copy this link using CTRL-C, its a direct link to Google Maps for the current map center and zoom level", url);
}

Duncan.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号