2
1

Easiest way of downloading all Cities | Towns | Villages (as defined by OSM) in the world, specifically these attributes for each
• Node ID
• Node Latitude
• Node Longitude
• Key (city or town or village)
• Name
• Population
• is_in:state_code
• is_in:country_code
I'm a non-techie, so please dumbify your answer accordingly. Thanks

asked 22 Mar '16, 19:41

kuroshhashemi's gravatar image

kuroshhashemi
41114
accept rate: 0%

edited 22 Mar '16, 20:06

aseerel4c26's gravatar image

aseerel4c26 ♦
32.1k16239551


OverpassTurbo will probably never work when you want to download all cities in the world. Take a look at the answer on gis.stackexchange

It says (with some extra details)

  1. download a planet extract
  2. use osmosis or osmfilter to filter out the data you need.

(Edit: this was a comment before)

permanent link

answered 24 Mar '16, 06:01

escada's gravatar image

escada
17.7k16148281
accept rate: 21%

1

Thanks, I would like to do this but I don't have space for the 500GB file

(24 Mar '16, 23:12) kuroshhashemi

In that case you will have to split the task is smaller steps. e.g. per continent or even per country for the larger continents. Download a smaller file, obtain the cities from it. Throw away the file, repeat for another file. Another remark, not all cities will have the tags is_in. It is not uncommon to rely on the containment of 2 features to determine the is-in relation. Maybe you can explain what you want to achieve with the list of cities, there might be another solution besides downloading the list. (Are you sure you can handle the amount of data you will get ?)

(25 Mar '16, 04:31) escada

@escada My application needs a CSV with each line a city and the metadata I bulleted above as columns in the file. Each city has a webpage that displays among other things city name and population (if avail from OSM). Each city has to be associated with country (and US State if in US) for search. I currently have such a file from geonames.org and want to swap out with OSM. It is probably 95% OK but from testing on Overpass Turbo I can see OSM has a more complete collection (and I trust their data better)

(25 Mar '16, 18:54) kuroshhashemi

https://wiki.openstreetmap.org/wiki/Overpass_turbo will help you - and maybe someone else here, too :-)

permanent link

answered 22 Mar '16, 20:07

aseerel4c26's gravatar image

aseerel4c26 ♦
32.1k16239551
accept rate: 17%

1

Hi, I've tried Overpass Turbo and my request times out even after I increase the timeout period. Also although I can pull Cities |Towns | Villages (for the map bounding box as a test), I can't figure out how to get just the fields described abobe

(23 Mar '16, 14:33) kuroshhashemi
1

@kuroshhashemi: Oh, I did not guess that it cannot handle that amount. Well, okay, on a second thought all villages may be a bit too much. Yes, by default you get all data for each object - maybe that could be restricted with some advanced Overpass API command, I do not know.

(23 Mar '16, 21:02) aseerel4c26 ♦
1

For a single country: http://overpass-turbo.eu/s/fed This produces a CSV list only (will not display on the map) restricted to name, position, and place. It takes about a minute, and it should be straightforward to write a script iterating over all countries.

(24 Mar '16, 17:45) Roland Olbricht

Thanks @roland-olbricht, yes I was thinking whether to workaround by splitting into smaller files like this... So many countries though =)

(24 Mar '16, 23:11) kuroshhashemi
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×240
×83
×14
×12

question asked: 22 Mar '16, 19:41

question was seen: 5,388 times

last updated: 25 Mar '16, 18:54

powered by OSQA