Jump to content

proximity search for zipcodes


diasansley

Recommended Posts

Some years ago I implemented this feature for someone using a php library I licensed.  There's a list of similar packages of all different costs, but the basic idea for each is the same -- mapping the zipcodes to long/lat and providing radius calculations to determine a result set. 

 

http://www.hotscripts.com/category/php/scripts-programs/zip-code-locators/

 

Here is a free script with database for mysql.  The script needs some work, and the data is somewhat out of date, but it would provide you a good basis for the calculations needed for determining proximity.

 

http://www.micahcarrick.com/php-zip-code-range-and-distance-calculation.html

 

It could be that it would be fairly easy to update it using this data, which might be more current -> 

 

http://www.populardata.com/zipcode_database.html

 

This dataset has even more zipcodes, so it might even be better:

 

http://www.boutell.com/zipcodes/

 

 

 

Link to comment
Share on other sites

Hi

 

In that case you join your table of locations with the table of zip codes getting the longitudes and latitudes and then use one of the common routines around to calculate the distance between each of the resulting rows and the longitude / latitude of the zip code that you want find everything that is within 50km of.

 

This is a thread wanting something similar:-

 

http://www.phpfreaks.com/forums/index.php/topic,266134.0.html

 

All the best

 

Keith

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.