views:

240

answers:

4

Hi all, I need to develop a solution that will provide the ability for a user to search based on a city and state. The user should have the ability to request that the search results include not just matches for that city and state, but also include matches in a 25, 50, 100 mile radius. I see that job sites do this type of thing. How is this done and are there vendors that provide open API's for it?

Thanks

+1  A: 

You'll want to start with a database of cities, states and zip codes with their corresponding latitude and longitude. Here's a link to a site where you can download such a database for free.

Next you'll need an algorithm to find which cities/zip codes are within an X mile radius of the city/zip the person entered. Here's another link that should explain how to do that.

Eric Petroelje
of course those databases come at quite a price since it's such a valuable commodity...
annakata
If you want the latest and greatest most up to date one, then yes. But you can generally find older databases that are 99% complete for free.
Eric Petroelje
+1  A: 

It seems that what you're looking for is a GIS (Geographical Information System) in which each (or some) piece of information is linked to its geographical location. Such sistems allow to perform spatial searches on those geographical location, eg. "give me all stores in a 5 mile radious from this position which sells a specific product" (combining spatial and traditional searches is also possible).

Now some examples of technologies you can use:

  1. PostgreSQL + Postgis: This opensource combination of database and geographical extension is powerful enough for most of basic user needs. You can start from here
  2. MySql Spatial
  3. Oracle Spatial
  4. ArcSde (ESRI)
amartin
A: 

You might wanna have a look at GeoNames.

I have written a .NET WCF client for GeoNames, available here.

baretta
A: 

You can have a look at http://www.zipcodeworld.com/storelocatordotnet.htm .