Generating a list of all the cities in the world with Wikipedia links
PlaneMad 于 2017年三月 8日 以 English 发布 最后一次更新于2017年三月 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.
讨论
dieterdreist 于 2017年03月15日 15:35 的评论
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?