Geographic Information Systems Asked by blan on April 24, 2021
I have a PBF file containing only rivers information (extracted using osmosis when waterway=river).
A conversion of this PBF to SHP works fine with ogr2ogr when I am selecting fields like “osm_id” and “name”. However, I would like to have the name of the rivers in different languages in the attribute table. The available translations appears in the “other_tags” column like this example: “name:en”=>”The Thames”,”name:fr”=>”La Tamise”.
Is it possible to create a SHP (or any other format) where the different translation of the rivers name would appear in different columns (eg. name:en, name:fr)?
This gdal command:
ogr2ogr -f 'ESRI Shapefile' -sql 'select osm_id,name,"name:en" from lines where waterway="river"' rivers.shp rivers.osm.pbf --config ogr_interleaved_reading yes -lco ENCODING=UTF-8
returns the following error: ERROR 1: Unrecognized field name name:en
Edit osmconf.ini file:
# Uncomment to avoid laundering of keys ( ':' turned into '_' ) attribute_name_laundering=yes
Add fields
# keys to report as OGR fields attributes=name,highway,waterway,aerialway,barrier,man_made,railway,name:ru,name:en
GDAL command:
ogr2ogr -overwrite -progress -f "ESRI Shapefile" railway_stations_ru.shp ukraine-latest.osm.pbf -lco ENCODING=UTF-8 -sql "SELECT osm_id, name, name_ru, name_en, other_tags FROM points WHERE railway='station'"
Answered by spatialhast on April 24, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP