I have about 1600 addresses that I need to plot on my map. I don't want to geocode at run time, because I believe it will take too long. Instead, I would like to geocode the addresses in advance, add their Lat/Long values to a table, and read from the table at run time. Unfortunately, I cannot figure out how/where to geocode a batch of addresses. Will one of you explain it to me and/or point me to a good tutorial?
Thanks in advance.
You can do this using the Google Maps Data API. The Geocoding section will be of interest to you (See API docs). Just write a PHP script to:
1) Loop through your addresses
2) Send HTTP request (use CURL or just file_get_contents()) to http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true_or_false
3) Parse the JSON response
4) Store in your database
Be aware that Google has usage limits. I'm not sure what those are so 1600 requests may or may not be an issue. You may want to add delays between requests and/or run it over several days.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With