21

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.

  • 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
18

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. – Michal Migurski Aug 1 '10 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 '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
  • 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 '10 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 '15 at 15:04
7

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

1

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.

0

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

0

GeoDataSource World Cities Database has a variety of options (lite to comprehensive) to choose from.

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

0

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.

-1

If you don't need whole world, because it's huge data, can try only those countries you need here http://www.alekando.ru/

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • 1
    You should spell out that this links to a non-free offering. – tripleee Jul 30 '18 at 6:54
-3

you can find 125000 cites list on my blog https://sajhatech.blogspot.com/2018/07/list-of-countries-states-and-cities.html

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • 1
    You should mention that it's your blog. – nmtoken Jul 30 '18 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy