[thelist] ?? How To: Search Zip Codes within x Miles ??

Matt Warden mwarden at gmail.com
Fri Jan 19 09:13:59 CST 2007

On 1/19/07, Casey Crookston <caseyc at intellisoftmn.com> wrote:
> We've all seen the tools that allow you to search for a business within
> 10, 50, 100, 500 miles of a given zip code.  Can anyone point me in the
> direction of how this is done?  We have not yet determined if the site
> will be in PHP or .NET, so we are open to all suggestions.

You need a database that relates zip codes or addresses to lat/long
coordinates. You then take a supplied zip or address, convert it to
lat/long coords using your DB, convert the destinations to lat/long if
not already done, then use simple trig (can find this algorithm
anywhere via google) to determine the distance between the two
lat/long coords.

The more precise you need it, the more precise your database has to be.

Matt Warden
Cleveland, OH, USA

This email proudly and graciously contributes to entropy.

More information about the thelist mailing list