2

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

1 Answer 1

1

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'"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.