Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
92
rated 0 times [  97] [ 5]  / answers: 1 / hits: 16604  / 15 Years ago, fri, december 11, 2009, 12:00:00

I am displaying a map on a website using the Google Map API. I want to include a link on that same page to take them directly to the map on Google Maps.



Is there an API call I can make to the map to retrieve the URL of either the current location/zoom level or the starting location/zoom level?


More From » jquery

 Answers
3

This is the link to use to centre Google Maps to a point:



http://maps.google.com/?ll=LATITUDE,LONGITUDE&z=ZOOM


All you need to do is to replace the above LATITUDE, LONGITUDE and ZOOM with the required coordinates.






To get the latitude and longitude where the mouse is clicked, you could use the following API code:



var map = new GMap2(document.getElementById(map_canvas));

GEvent.addListener(map,click, function(overlay, latlng) {
if (latlng) {
// latlng defines the latitude and longitude where the mouse was clicked.
}
});

[#98090] Tuesday, December 8, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sergiobrayanc

Total Points: 162
Total Questions: 97
Total Answers: 94

Location: Lesotho
Member since Wed, Jun 2, 2021
3 Years ago
;