Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I asked this question Stack Overflow but I was informed that I would get a better to this question here because it's not related to programming.

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.

share|improve this question
Is location important, or are you just looking for a hierarchy? I see you are going to be using "categorization by location", but are you planning on using attributes (like a lookup table) or a spatial search (like "what's near me")? – mwalker Aug 1 '10 at 18:05
I am just looking to create a hierarchy, that's it. I wont be using attributes or spatial search. It's just going to be used so that I can properly categorize listings using their locations. – Naif Amoodi Aug 2 '10 at 3:03

[Re-posting my answer from StackOverflow. Man, this is going to be annoying if we have to do this for every question from now on.]

Excellent question. 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.

share|improve this answer
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 '10 at 3:10
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 '10 at 3:12
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:… 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 '10 at 6:50

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

share|improve this answer

Yahoo Geoplanet data has been taken off, here's the last version:

share|improve this answer

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.

share|improve this answer

I vote for GeoDataSource World Cities Database. They have variety options (lite to comprehensive) to choose from.

Anyway, the list doesn't change that frequent from time to time, not like the ip address range. Therefore, shouldn't be much worry about the database update matter.

share|improve this answer

I would recommend that if you can process data yourself then you can go for free database or shell out a few bucks for a cities database from Even geonames is a good resource to look..also check for a open source cities database hosted on

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.