How to show nearest store based on zipcode
I am creating an app tha is for a a bussines that has 开发者_开发知识库several stores around the state. How can i show the information for the nearest sores based in the zip code?
Thanks for any help
The basic idea is:
- Convert the ZIP code to geographical coordinates (longitude and latitude).
- Compute the distance of each store to this coordinate.
- Order the results by distance, ascending.
Step 2 can be optimized a bit -- for example, you might limit the search to those stores in the same state. You may also want to limit the number of stores returned if you are only going to display 10, for example.
This is about all the detail I can provide since your question is quite general.
精彩评论