I am creating a directory which uses locations to categorize all listings. Instead of relying on user input, I'd like to provide a list of locations which the user can select. I have already tried GeoWorldMap which is provided by GeoBytes but it has certain issues. For example, it lists 275 countries. Other than that, their database is updated on a regular basis so that means if I maintain a local database, I'll need to update it every now and then to make sure it's up to date.

I want to know what developers use for this. Instead of a database, do they use some service to fetch a list of locations?

I am afraid manual user input is not an open option because categorization by location is going to be essential so I cannot trust or rely on what the user enters manually.

I have seen few sites doing this so I am sure there is a practical solution out there.


4 Answers 4


I think Yahoo!'s GeoPlanet can be very useful for this: they provide a pretty exhaustive list of places and the hierarchical relationships between them, and you can either download the list of names or use their API.

Other gazetteers (that's the term-of-art you're looking for) include GeoNames, which also has downloadable data free of charge. (I'm sure StackOverflow or even a Google search could get you more options along the same lines.)

Also, if you're planning to create a UI to let users select from your list of places, I like to suggest the Freebase Suggest plugin, a jQuery plugin that will force users to select from a certain category (in your case, countries, say) and provide a nice UI for choosing from what Freebase's semantic database considers correct. It even provides some wiki-like context to help with disambiguation.


Here's a couple of sources of free city location databases:


Have a look at GeoDB Cities. This is a service I've developed and host that wraps the GeoNames.org data in a REST interface. I believe it should provide what you're looking for in terms of stable data. No old city data is ever physically deleted, only marked as such (which can happen on a refresh from GeoNames). The service also lets you display city/region/country results in multiple languages.

The free instance is pretty reasonable IMO, but I'm biased of course.


There are multiple paid and free sources for country city databases:

  1. GeoNames is free data but lots and lots of data. You will have to take a DBA's help to cleanup the data. But it is a one time effort to clean and load the data as per your requirement. I ended up with a 1.3 GB file size after zip extraction and loading this data to DB also requires a good powerful hardware.
  2. MaxMind data is very old and they have stopped updating the free data that they provide
  3. Paid GeoDatasource data
  4. Cities database from http://www.worldcitiesdatabase.com which is at reasonable cost.
  5. Then you can look at MaxMind paid data services as well but they are very costly unless your budget is very good.

Choice is yours. I think the data quality might differ with each above vendor.