• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

Zip Code / Search for Dealer

Question

ccpa    0

What is the most cost effective way to add a zip code search or search for nearest vendor to a site?

Thank you for your help!

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0
figgy    2

Basically, you need a list of all zipcodes and their correspoding latitude & longitude.

This is publically available information on some .gov site.

Then you have list of dealers and their lat/longitude location.

(You can use Mappoint to create this list)

From this it is a simple matter of calculating the distance using lat./long. from a given zipcode to all the dealers.

The calculated distances are then sorted to give the list of nearest vendors.

If you have a database, you can precalculate and store the calculations for all zipcodes.

Share this post


Link to post
Share on other sites
  • 0
ccpa    0

Thank you for the information. I will definitely look into this. Do you know a good way to convert longitude/latitude to miles/km?

Share this post


Link to post
Share on other sites
  • 0
figgy    2

The distance formula is

Where all angles are measured in degrees

R = Radius of Earth = 6378.1 km = 3963.1676 miles

post-46-1091469764.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.