Search of shops by zip code

Asked

Viewed 383 times

1

I am developing a site with PHP and Mysql where register several stores, and each store serves a region of the city.

What would be the best strategy to adopt in this case, where I have the CEP of the customer and want to check which is the nearest store in the city that will be able to serve the customer?

I thought I’d save the - Lat and Long of the store, and define a region to which it meets with Google Maps, but how can I check later if the CEP is within that area?

1 answer

1

What is the granularity of your shops? City? Neighborhood? Block? Since the zip code is a structured code, you can try searching successively for larger parts of the zip code. For example, if the customer’s zip code is 89213-123, you could search for 8, 89, 892, 8921... the first search could find a store in Curitiba (88xxx-xxx), the second will already isolate the North Coast of SC, the third isolate Joinville, and so on.

A sophistication of this search may be the search for proximity to the non-scoindicent digit, for example a store in CEP 8922x-xxx probably better serves a 8923x-xxx customer than an 8927x-xxx, because as far as I understand the Post Office leaves Zip Lines geographically close with 'close' numbers also.

Certainly the Post Office can sell you a database with the GPS coordinates of the Zip Codes, but this is charged and you need to pay for the updates.

Browser other questions tagged

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