Main Content

Converting from postal address to latitude / longitude

Archive - Originally posted on "The Horse's Mouth" - 2007-10-13 07:36:43 - Graham Ellis

Do you sometimes find odd gaps in new procedures you follow - "I can see everything I need to do to make X happen, except" ?

I hit one of those yesterday. When learning how to interface to Google maps ... all the information was there, except there was no way that I could spot to click on a map and say "what latitude / longitude is this?". Of course, I may well have missed an option.

Why the problem? Because I wanted to hard code certain data - such as our location - into the demo I was writing.

Alternative approach - to type in a place name and have the system tell me the latitude / longitude which I can do .. not via any standard page I could find but vis Google's own API.

Source code - here

Working demo - here - to which I've added an automata trap after 27,000 hits from a single host!