Country/State/City Database?

Naif Amoodi picture Naif Amoodi · Aug 1, 2010 · Viewed 12.6k times · Source

Possible Duplicate:
Database of Countries and their Cities

Ok, this one is a non technical question. I am creating a business directory and I'd like to categorize listings by location. Instead of giving users an option to enter the location, I am going to provide them with a list of locations which follow a Country/State/City format. I tried GeoWorldMap by GeoBytes. It looked promising in the beginning and I felt that is exactly what would get the job done until I realized it provided a list of around 275 countries even though the number of countries that are recognized is between 192 to 195. So I am not sure about the extra 80 countries. When I realized this issue, I went to their website to do some reckon and found out that their list is updated on a regular basis. So this brings a question to my mind. Is it possible to find an accurate database that lists all possible locations? What do most developers here use for something like this?

Answer

npdoty picture npdoty · Aug 1, 2010

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.