Google Maps - Pre-Geocoding Many Addresses?

I have about 1600 addresses that I need to make on my map. I don’t want to geocode at runtime because I believe it will take too much time. Instead, I would like to pre-geocode the addresses, add their Lat / Long values ​​to the table, and read from the table at runtime. Unfortunately, I cannot figure out how / where to geocode a batch of addresses. Do any of you explain this to me and / or call me a good textbook?

Thanks in advance.

+3
source share
2 answers

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) Scroll to your addresses

2) Send an HTTP request (use CURL or just file_get_contents()) tohttp://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

Remember that Google has usage restrictions. I'm not sure if this is so, 1600 queries may or may not be a problem. You can add delays between requests and / or run them for several days.

+5
source

In the interest of troubleshooting TOS errors and performance / throttling issues, you might consider looking for an alternative service.

SmartyStreets, . Google (, , ), CASS-Certified , , lat/lon. API LiveAddress, .

  • API ( 100 )

  • (1600 . ).

  • - ; , .

, , , . , .

+1

Source: https://habr.com/ru/post/1772536/


All Articles