I'd like to build or find a script that will allow me to take a zip code provided buy my user(s) and figure out all the zip codes within a specified radius from that zip code. Can someone point me in the right direction?
I can use either a CGI script OR PHP. I'm on a Linux/Apache server. I normally don't cross post, but since either version is acceptable, I'm going to do so in this case.
Please reply to the thread in the CGI forum--here's (http://www.codingforums.com/showthread.php?t=50058) the link to that thread.
Thanks for any assistance you can provide.
do you have a zip code database with latitude and longitude?
No--do you know how/where I can find one?
you have to buy it.
you can buy it from here, I don't know how "trustworthy" this site is so heed my warning:
I haven't personally bought any zip code database but someone at work had already acquired a database somehow, I'm not sure of the legality of sharing it since you would think it would be public information. if someone can backup the legality of sharing it then I can hook you up.
I read somewhere that someone obtained a zip code DB from the census bureau. And you'd think the info would be available from the postal service. Both are government agencies.
I'd even be willing to visit a web site, type in the the zip code and radius and have it tell me the zip codes within that radius--IF such a site is available that is.
I'm creating a form via which a visitor will tell me the zip codes and radii from them in which he's interested in purchasing property. I don't expect to get a LOT of requests in the beginning so I think I'd be fine with processing each one manually.
Well I found such a site AND it's free!
As things grow, I'll probaly have to buy a DB and put together a script to automate the process--but for now this'll be good.
01-10-2005, 02:00 PM
I've doen this type of thing before for one of my clients. One thing you should probably be aware of is that you will be dealing with spherical coordinates, so you'll have to adjust your distance calculations accordingly. If you google for "distance equation sphere" you should get some results. I think if you add "php" to that, you'll even get some scripts. Most of these require conversion from lat/long info to degrees or radians though. Otherwise the process is pretty simple.
Also, if you do a google search for "ZCAT Zip code data US Census" you should get some links to the free Census data for ZIP codes.
09-14-2006, 04:01 AM
I think this websites might help you:
http://www.zipcodeworld.com . It provides free ZIP Code Sample, as well as Distance Calculation Formula. I use this service before and the information is quite complete and updated. Worth to give a try.:D