I currently have a mySQL table of addresses of certain locations that I need to obtain Latitude and Longitude for. This is a table being used in WordPress to map store locations to google maps. I am looking for the best way to obtain the lat/lon for all of the records in this database.
Does anyone know a simple strategy I could use to run through all of the records and obtain the lat/lon of each address?
Google have the Geocoding API – http://code.google.com/apis/maps/documentation/geocoding/
Not sure what kind of addresses you mean. If IP then there are databases that will give you the approx lat and long for most of your visitor’s IPs. You will have to capture it then.
If you mean postal addresses then, I know of nothing to help world wide. In the UK, the Royal Mail’s PAF used to contain lat and long, but you must have the post code. I suspect there might be similar data available for ZIP codes in the US and Cedex codes in France.
Other than that, I expect you will be out of luck.
Are you asking for code? I use a bash script to solve it. It’s not a copy actually it is quite simple with Linux bash commandl-ine. Most likely you want to dump your database into a text file and then read and query it from them shell. It took me about 4-5 hours for a country like Germany with postcode from 0-99999.