Find nearest Google Maps addresses

Asked

Viewed 2,470 times

3

I have over 2000,000 records in a database with address and zip code, and I want to locate the closest establishments to my zip code using the Google Maps API.

Example of what I need.

But in my case I want to locate some of the records in the database closest to the typed zip code.

  • 2

    There is already a lot of light here on the site (http://answall.com/questions/tagged/google-maps), the ideal is to search before asking (check the mini guide [Ask]). And welcome to the site :)

  • Good afternoon, I did not understand is to locate address or establishments? The title says one thing and the question another.

  • bigown, did you manage to do this functionality the way you asked here? How did you do?

1 answer

3

One solution is to consult the API with each ZIP code saved in the bank (Destinations), with the EPC informed by the customer (rigins), save to a list and sort at the lowest distance value.

To limit the consultation, the city can be used as a parameter, looking for only the CEP (of the bank) of the city informed by the customer.

Example: http://maps.googleapis.com/maps/api/distancematrix/json?origins=99064090&destinations=saopaulo&mode=driving&language=pt-BR&sensor=false


I still believe that this tutorial can help you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.