OSM Names

Aus Wikizone
Version vom 18. November 2019, 18:48 Uhr von 37.49.72.8 (Diskussion) (Die Seite wurde neu angelegt: „Data extract for one country It is pretty easy to filter the records for a country of your choice from the downloaded planet dump. Use a command like: $ zca…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

Data extract for one country

It is pretty easy to filter the records for a country of your choice from the downloaded planet dump. Use a command like:

$ zcat planet-latest.tsv.gz | awk -F '\t' -v OFS='\t' 'NR == 1 || $16 == "ch"' > switzerland.tsv

Where “ch” is the 2 letter country code according to ISO-3166, in this case for Switzerland. Similarly, it is possible to extract only records of certain types or classes, as well as setting a filter on another column. Data extract by bounding box

Because the data contains lon/lat columns as well as bounding boxes (west, south, east, north), you can also extract all records by geographical filters.

To create an extract of all place names in the area of Zurich in Switzerland you can run a command like:

zcat planet-latest.tsv.gz | awk -F '\t' -v OFS='\t' 'NR == 1 || ($8 > 47.225 && $8 < 47.533 && $7 > 8.275 && $7 < 8.800)' > zurich_switzerland.tsv

To find the relevant bounds check the Bounding box tool or list with city and country boundaries. Data format details

The data is generated in the TSV format, which is a tab separated spreadsheet file with one record per row. The first row contains the name of the columns. All characters are utf-8 encoded. The files distributed with a release are compressed using gzip. We suggest you to use gunzip or zcat to extract the raw text.

The columns have a fixed order:

name 				the name of the feature (default language is en, others available(de,es,fr,ru,zh))
alternative_names	all other available and distinct names separated by commas
osm_type			the osm type of this feature (node, way, relation)
osm_id				
class				
type
lon
lat
place_rank			rank from 1-30 ascending depending on the type and class
importance			importance [0.0-1.0] depending on wikipedia if available otherwise just the ranking
street 				
city
county
state	
country	
country_code		ISO-3166 2 letter country code
display_name		the display name representing the hierarchy
west				bbox
south				bbox
east				bbox
north				bbox
wikidata			the wikidata associated with this feature
wikipedia 			the wikipedia URL associated with this feature