If you want to implement this for yourself, you need to start with two pieces: a database of zip code data including latitude/longitude, and (to make things as simple as possible) an OpenGIS extension package for your database. This gives you the ability to index on latitude/longitude and do quick lookups using a "distance" function in the WHERE clause of your query. The implementation for PostgreSQL is called PostGIS (http://www.postgis.org); if you're using some other database then you will have to find the equivalent extension on your own. I wouldn't be surprised if some high end databases have this functionality built in.
Zip code databases are available from about a million different sources. I was most pleased with the offering from http://www.zipcodeworld.com, but I'm sure that I did not investigate them all. In my experience, the data is a bit shoddy in all of these collections. You may not have problems with that until you try to combine it with something like gazetteer data. In about 2,000 cases, that becomes a nightmare. If you can avoid that...do!
I have an SQL INSERT script which was generated off of the September topical gazetteer and zip code databases, but with everything pulled in I believe it weighs in at something like 40MB. :-/
Tauren Mills wrote:
I apologize for this being off topic, but I have a feeling some of you might have some ideas for me. I'd like to implement a feature that will search for all physical locations in my database that are within a radius of a zip code. In other words, the user enters a zip code and selects a distance from a drop down list (5 mi, 10 mi, 25 mi, 50 mi, etc.) and a list of all locations within that distance of the zip code will be displayed. You can see something similar to this at: http://www.restaurant.com/ Are there any web services out there that would simplify this task? I have been looking at the Google Geocoding API (http://www.google.com/apis/maps/documentation/services.html), but am not sure how much it will help. I could geocode locations as they are added to my database and store the lat/long, but I get fuzzy on how to proceed from there. Somehow my SQL query (using hibernate) would need to do some computation to see if the lat/long stored in the DB is within the specified radius from the lat/long of the specified zip code. I guess I mostly want to hear from others if this would be the way they would do it, or if there is some other way that would work better or be simpler. Thanks! Tauren --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]