I was wondering if anyone has a lead on a corpus of geographic locations? City names and coordinate pairs would be ideal. I'm training a chatbot and I'd (ideally) like it to be able to pick up on locations in the chat and then display a map if requested. For example, if the words "I'm headed to Chicago" were typed, the chatbot could render a map of Chicago. Wishes and wants aside, if y'all do know of one or how I could make one, I'd appreciate it.

Thanks

up vote 1 down vote accepted

There are probably lists, so if you are looking for single regions or languages, then this answer may be a bit much, but...

You can download the entire planet from Open Street Maps (OSM) and then filter out the relevant tags (see this answer). In your case you would filter on place, see this example filter:

./osmfilter planet.osm --keep="place=city =town =village" > my_places.osm

Your geocoordinates will actually be a multi-polygon, but that's OK because you can either simplify to a geopoint (e.g. use the centroid), or show the entire polygon range in your map.

Instead of planet.osm you can also do this for illinois.osm, or whatever region you want.

  • In this particular case, I think OSM might be overkill and geonames.org might suffice. – Barry Carter Jul 7 at 13:58
  • @BarryCarter can you add an answer? I had looked at geonames.org but didn't find one dataset that fit – philshem Jul 8 at 19:30
  • My thought was just to download all of geonames.org (it's not that big) and use the whole thing to find placenames. I don't think my pointer is answer-worthy though-- just a general thought. – Barry Carter Jul 9 at 3:12

Here's the geonames answer that should have been accepted.

Download one of the cities files (readme.txt)

cities1000.zip : all cities with a population > 1000 or seats of adm div (ca 150.000), see 'geoname' table for columns

cities5000.zip : all cities with a population > 5000 or PPLA (ca 50.000), see 'geoname' table for columns

cities15000.zip : all cities with a population > 15000 or capitals (ca 25.000), see 'geoname' table for columns

The city name, ascii name, alternative name (etc) and latitude,longitude are available - one per row. In the readme search for 'geoname' table for the column list descriptions

Link to export files

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.