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.

  • Seconding GeoPlanet. One of the nice things about the identifiers (WOE IDs) in the data is that they are designed to be stable, so you won't find yourself looking at conflicts with future updates to the DB. Aug 1, 2010 at 19:59
  • 1
    Thanks for providing those links. I spent a lot of time working with both and successfully implemented them but now I am going to just quit. Everything looked good as far as countries and states are concerned but the structure used for everything below states is so inconsistent. I no longer find it to be practical. Some countries have both States and Cities and some have only Cities but instead of States, these countries have Provinces. I was under the impression that this is how it would be like. But it's not. States from the USA go around 3 levels down. Even though Atlanta is a city...
    – Naif Amoodi
    Aug 2, 2010 at 3:10
  • 1
    in Georgia, this is how it looks: USA -> Georgia -> Fulton County -> Atlanta. And Fulton County doesn't just have Atlanta, it lists various other locations too and not everyone of them is a city. It also lists Adamsville there which is actually just a place.
    – Naif Amoodi
    Aug 2, 2010 at 3:12
  • 4
    Absolutely, these are not straightforward problems; the possible hierarchies are complex (and by some definitions, unlimited) and depend on different cultural norms and governmental regulations as well as various use cases. I'd recommend looking at the documentation, which may help a lot: developer.yahoo.com/geo/geoplanet/guide/… You can pull out just the cities if you want, or just the administrative divisions. And Yahoo!'s documentation explains the different hierarchies. Still, I understand your frustration, it's complicated! Best of luck!
    – npdoty
    Aug 3, 2010 at 6:50
  • Yahoo Geoplanet data has been taken off, here's the last version: archive.org/details/geoplanet_data_7.10.0.zip
    – 0fnt
    Mar 12, 2015 at 15:04

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.