Re: Finding zipcode within radius of another zipcode.
| From: | justin gruenberg | Date: | Wed, 25 Dec 2002 16:49:08 +0000 |
| Subject: | Re: Finding zipcode within radius of another zipcode. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-24369@lists.php.net to get a copy of this message | ||
Actually, the US Census Bureau provides the information for free, but you have to do some work to associate a ZIP code with the data they provide. Since zip codes dont have any real shape to them, and change often, the census people have assigned their own numbers to different areas. We've found it easier to to just ask the user for the state in which they live, and then the city, choosing the city from the database that most closely resembles what they said.
http://www.census.gov/geo/www/gazetteer/places2k.html
At that URL you can download all of the information in a text format. With that information you get the lat/long coords of the cities, and it just takes the formula (to long to remember) to find the distance between the two points on a sphere.
Good luck.
gilrain wrote:
Hi folks, I'm building a PHP/MySQL database for a customer. It's an advanced mailing list for a band. They want to be able to send e-mails targetted to people around where a gig takes place. For instance, if a concert is taking place somewhere in the 42071 zipcode, they want to e-mail everyone within 500 miles of 42071. The database will have around 10,000 members, with e-mail and mailing addresses. Does anyone have a good idea for this? Thanks a ton, John Thile (gilrain) http://lunarpolicy.net