user359519
user359519

Reputation: 711

Google Maps - Pre-geocoding many addresses?

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.

Upvotes: 3

Views: 1282

Answers (2)

Matt
Matt

Reputation: 23789

In the interests of steering clear of TOS violations and performance problems/throttling, you might consider looking into an alternative service.

I work for a company called SmartyStreets where we geocode and verify addresses. While Google will make a best guess of the validity of an address (and thus the accuracy of the geocoding), something that is CASS-Certified will first make sure the address exists before returning the lat/lon coordinates. We have a service called LiveAddress API which does this.

  • You can perform bulk geocoding with our API (up to 100 addresses per request)

  • You can store the results (1600 addresses is actually a really small number. We can handle datasets as large as tens of millions on a regular basis).

  • It's fast -- and no throttling or usage limits; you pay for what you use.

From what you've mentioned, I think this would meet your needs. Let me know if you have any other questions.

Upvotes: 1

Andy Hin
Andy Hin

Reputation: 31973

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.

Upvotes: 5

Related Questions