Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
2  
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

5 Answers 5

[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
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 '10 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 '10 at 3:12
3  
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 '10 at 6:50

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

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

When I was looking for a decent database of world cities for my web project, I tried using all of the free city databases out there. I even paid for a couple of them.

But none of them satisfied me. They either had too much useless information (like longitudes, administrative subdivisions for tiny countries, or thousands and thousands of entries for small countries) or too little.

This is why I decided to create my own database.

After that was done I decided to share the results of my work with the world.

I offer my database both in Excel and SQL formats. I am offering it for a ridiculously low price of $4.99 for Excel or SQL, or $6.99 for a bundle of the two formats.

It has over 40,000 of U.S. cities and a total of over 70,000 cities. To me it is the perfect balance between completeness and usefulness.

If you are interested, visit http://worldcitiesdatabase.info and see if my database is right for you.

share|improve this answer
    
Thank you Michael, I am new here, so I didn't realize it was supposed to be mentioned. I edited the post at your suggestion. –  WorldCitiesDatabase May 12 '11 at 1:42

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

Your Answer

 
discard

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