Gossamer Forum
Home : General : Perl Programming :

Zip Code Surrounding Areas Logic???

Quote Reply
Zip Code Surrounding Areas Logic???
When you put in your zip code in database search engines such as http://www.777film.com or http://www.nissan.com (dealer locater), the script finds matches in your zip code, but also surrounding areas. How does it determine your surrounding areas based on your zip code? Any help would be appreciated. Thanks!
Quote Reply
Re: [Spydyrman] Zip Code Surrounding Areas Logic??? In reply to
I know this post is really old. But I found some info that might help somebody accomplish this. I wish I was perl-savvy enough to try it myself but I'm not. Maybe a guru out there can give it a shot

here is where all US zip codes and latitude/longitude can be downloaded for free (Zips.zip): http://www.census.gov/geo/www/gazetteer/places.html

And here is code to generate the distance between two latitude and longitude points (in VB though): http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=43549&lngWId=1

So I guess you'd add the Zips table to your database and run a full table scan on it, using the function above on each record to calculate the distance between the zip code (lat/long) that the user typed.

Could be an interesting mod!