Thursday, September 16, 2010

How to Geocode an address with Google Maps

I get a lot of emails to Geocoder.US asking for me to look up addresses.  The Census data which we use does not know everything :-)

I do my best to help people, but mostly what I do is go to http://maps.google.com and look up the address.

This post describes how you can get a latitude and longitude from an address...




Double click on the map just next to the map icon for your desired address.  This is a trick to get Google Maps to 'remember' the lat/long you care about.  If you don't do this the next part will (probably) not have the 'll' parameter which you really want...

There is a small link to the top right of the Google maps pane which says 'Link.'

Note the 'Link' link on the top right
Drop down after clicking 'Link'


The resulting URL is enough for Google Maps to recreate this view, which means it has your searh term (in this case 'Gerlach, Nevada').

http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Gerlach+Nevada&sll=37.09024,-96.503906&sspn=34.671324,77.431641&ie=UTF8&hq=&hnear=Gerlach,+Washoe,+Nevada&ll=40.649713,-119.356241&spn=0.023834,0.050726&t=h&z=14

The latitude and longitude are in this part of that URL: "ll=40.649713,-119.356241"



Don't use 'sll' or 'sspn' - even though those look like lat/long pairs...those are not the pairs you are looking for :-)

And please let me know if you have any questions!



Once you click link you can copy the long messy looking URL (or if you want to put the map into your own web site copy the code in the second box which says 'Paste HTML to embed in website.'


2 comments:

  1. you can do similar thing using MapQuest too but much more simpler way.. Enter any US/Canada address here --> http://developer.mapquest.com/web/tools/lat-long-finder you will find lat/long on top of map screen. Hope this helps.

    ReplyDelete