views:

77

answers:

2

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?

A: 

Sounds like a question best asked on http://gis.stackexchange.com

fmark
I agree that this question *could* be posted there however, I think that it would be bad for the SO community to remove questions like this. Please do not close this question. I feel it is relevant to the community and I feel I have learned by looking at this question.
sixtyfootersdude
Also it will be confusing for new users if for every kind of answer we point them to a different community. At this rate there will be no questions that will be allowable on SO. I am giving you a +1 for your answer, however I think it is critical that this question remain open on SO.
sixtyfootersdude
-1. This is not an answer, it's a comment.
Adam Robinson
+2  A: 

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.

npdoty
Freebase Suggest is cool as all get-out, but it's a little tricky if you want to discern which regions are included in other regions for the purposes of search. E.g., if a user says they are in Boulder, then searches for people in Colorado, the USA, North America, or the world should include that user. I'm guessing Freebase has that data but you need to use their web services APIs to do that, and I suspect you couldn't do it efficiently without owning a local copy of the region hierarchy.
MikeJ
@MikeJ It definitely gets thornier the more complex your use case is. It is worth noting that the RDF that Freebase provides for locations does include location `containedBy` properties so it should be possible to traverse geographic hierarchies with an RDF parser (for Boulder, Freebase has Boulder County, Colorado and the United States listed as containers). Whether Freebase's location ontology is good enough for your purposes is another question; I think Yahoo! has done a good job with GeoPlanet on addressing these issues.
npdoty