Get Longitude and Latitude from Google Maps

by Matt 26. July 2009 18:27

When using the API for Google Maps, you will need to insert the longitude and latitude into the code when you wish to embed a map into your page.  Unfortuneately Google Maps doesn't give you these values when you search for an address, but there is an easy way to get them. 

First, look up the address on Google Maps.  Don't move the map around at all, as doing so will give innacurate values for the location you desire.  

Copy and paste this code into the address bar, and click enter:

javascript: void (prompt('', gApplication.getMap().getCenter()));

Voila!  the longitude and latitude values will appear in a popup.

h/t

Categories: Javascript