the kdmcinfo weblog

Finding longitude and latitude of a location using Google Maps

In all of the data mapping sessions we have been teaching recently, one question seems to keep coming up: How do I find the longitude and latitude of an address or a location on a map?

Well, you could use a Global Positioning System (GPS) device, and actually travel to the location to find those coordinates. But that's not very practical for many obvious reasons.

My friends, there is an easier way. Using Google Maps, you can search for an address or simply zoom into a location you want to find the coordinates for. To make this work property, the trick is to center the map on the point that you are trying to find the coordinates for. If you are trying to find the geolocation of an address for example, just type in the address and Google will automatically center the map on that point. But if you move the map, you will skew the results based on the new center point of the map. If you ever want to center the map on a specific location manually, you can right click (control + click on a Mac) on the point in Google, and use the "Center Map Here" option.

Once you have your the desired location centered on the map, you can retrieve the coordinates by typing (or copy-and-pasting) the following code into the URL portion of the window that has the Google Map:

javascript:alert(window.gApplication.getMap().getCenter());

if you type this in manually, make sure you do type it exactly how it is written here (and it is case-sensitive). If you want an easy way to remember this for later, you can bookmark the page only after you have typed it in and pressed return. This is called a "bookmarklet" and it will work any time you're at a Google Map and want to retrieve the geolocation of a spot.

Happy geo-hunting!