OpenStreetMap 로고 OpenStreetMap

Generating a list of all the cities in the world with Wikipedia links

PlaneMad님이 English로 2017년 3월 8일에 게시함. 최근 2017년 3월 9일에 업데이트됨.

A small tutorial on how one can export a CSV of all the cities in the world with their associated Wikipedia and Wikidata pages. This is useful if you want to do some spreadsheet analysis of data from OpenStreetMap.

Overpass Turbo is a great way to quickly extract data from OpenStreetMap by querying tags. An easy way to generate the query is to type “city” or the specific tag “place=city” in the wizard. Since most cities are tagged as just a point node, we can remove the query for ways and relations.

Also instead of the default geojson output, you can use the CSV output format and specify the the data columns to export. The end query looks like this:

[out:csv(::type,::id,name,”name:en”,wikipedia,wikidata)][timeout:200];

( node[“place”=”city”] ({{bbox}}); );

Try the live query (takes around 2 minutes to run) View results

The same query with a geojson output gives the map view

You might also be interested in reading about how one can query a similar list from Wikidata.

이메일 아이콘 Bluesky 아이콘 Facebook 아이콘 LinkedIn 아이콘 마스토돈 아이콘 텔레그램 아이콘 X 아이콘

토론

2017년 3월 15일 15:35dieterdreist님의 의견

You’d better change the live example with something less ressource consuming, if it’s for demonstration purposes only. Why do you think it takes 2 minutes?

댓글을 남기려면 로그인하세요