openstreetmapqgisosmosis

Osmosis for OpenStreetMap data - fields lost when extracting data


I have downloaded a pbf file, france_latest.osm.pbf, from geofabrik.de and want to use osmosis to filter it to get a .osm file with just the major roads. Here is my osmosis command string:

osmosis --read-pbf france-latest.osm.pbf --tf accept-ways highway=motorway,motorway_link,trunk,primary,secondary,trunk_link,primary_link,secondary_link --used-node --write-xml roads_m_1ry_2ry.osm

This produces a .osm file with the correct items, but it does not contain any field information to distinguish the different types of highway so I can display them in different colours in QGIS. I did the same operation a few years ago and the field information was contained in the filtered export so I am not sure why it hasn't worked this time. Is there something else I need to add to my osmosis command to get the field information?


Solution

  • The highway type data was in the .osm file generated by osmosis. It seems the information was getting lost when I tried to convert the .osm to a .db spatialite file to load into QGIS. But with QGIS 3 you no longer need to do this, as you can import .osm files directly into a project.