PDA

View Full Version : Geocoding (was "Canon Mexican Locations")


pmulcahy11b
07-12-2009, 09:13 PM
I've got 5 days until my oilfield processing is done due to a Google limitation on how often you can search for lat/long locations (once every 1.7 seconds)...

How'd you get that search automated?

kato13
07-12-2009, 09:42 PM
How'd you get that search automated?

I do most of my stuff via a perl backend on my webserver but there is a neat pure html/javascript way to do it.

First you need to get a map key for your website.
http://code.google.com/apis/maps/signup.html

Second view and copy source from this page.
http://maps.juhlin.com/maps/geomulti_demo.htm

Third Replace my map key with yours.
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=***your_key_here***" type="text/javascript"></script>


Fourth Put the addresses you want in here.

var addresses = [
"PAWNEE EAST, OK",
"MEHAN NE, OK",
"RATTLESNAKE, OK",
"ORLANDO EAST, OK",
"HARTSHORNE, OK"
];


Fifth upload the file to your webserver and view it. It will process about one record every 2 seconds.

It works nice up to about 1000 records then the browser slows down so I suggest breaking the data down into ~1000 record chunks.

Edit; Oho another thing is that is is usually best to provide a full state name to Google as they will often interpret CA as Canada and CO as Columbia and KY as one of the Former Soviet republics.

kato13
07-12-2009, 09:46 PM
Here is another source for a simpler multi geocode solution.

http://www.batchgeocode.com/

I really don't like it though. It uses Yahoo's geocode model which tries to always return something. If it can't find a city within a state it returns the center of the state. Google tells you when it cant find something which is much more useful IMO.