Category: ‘Google Maps’
Get the centre of a Google Map as Latitude and Longitude
by Jonathan on 28th Nov 2009 in Google Maps
Here’s a nice little javascript function to get the Lat / Long coordinates of the centre of Google Maps – I found it prticularly useful once when creating a flash map which showed the locations of a national chain of golf fitting centres.
javascript:void(prompt('',gApplication.getMap().getCenter()));
To use it simply go to Google Maps, centre the map on the place you want the coordinates of, enter the code above into the address bar and hit enter. A nice text field alert will pop up allowing you to copy the Lat / Long values.
If you’re going to be doing this regularly you may find it useful to create a Firefox bookmark with the code set as the location. That way you can simply hit the bookmark and have the coordinates appear (as long as you’re on Google Maps that is).