I want to extract all major roads (motorway, trunk, primary, secondary) of the world from OSM data. So far I downloaded the continent.osm.pbf files. Now I need to convert them into .shp-format. Searching for a way to do so I found the ogr2ogr-tool and so far, it extracts all lines to a sqlite database.
ogr2ogr -f SQLite continent.sqlite continent.osm.pbf lines
Now I also wanted to edit the osmconf.ini file, so that it only includes highways with the tag: motorway, trunk, primary, secondary. I deleted other keys such as waterway,aerialway from the file, but it does not exclude them from the sqlite-database.
# keys to report as OGR fields attributes=name,highway
Further, I just want highways with the tags "motorway, trunk, primary, secondary", but the only line where it seems to be possible to select them is the following line, which I do not understand fully
z_order_sql="SELECT (CASE [highway] WHEN 'minor' THEN 3 WHEN 'road' THEN 3 WHEN 'unclassified' THEN 3 WHEN 'residential' THEN 3 WHEN 'tertiary_link' THEN 4 WHEN 'tertiary' THEN 4 WHEN 'secondary_link' THEN 6 WHEN 'secondary' THEN 6 WHEN 'primary_link' THEN 7 WHEN 'primary' THEN 7 WHEN 'trunk_link' THEN 8 WHEN 'trunk' THEN 8 WHEN 'motorway_link' THEN 9 WHEN 'motorway' THEN 9 ELSE 0 END) + (CASE WHEN [bridge] IN ('yes', 'true', '1') THEN 10 ELSE 0 END) + (CASE WHEN [tunnel] IN ('yes', 'true', '1') THEN -10 ELSE 0 END) + (CASE WHEN [railway] IS NOT NULL THEN 5 ELSE 0 END) + (CASE WHEN [layer] IS NOT NULL THEN 10 * CAST([layer] AS INTEGER) ELSE 0 END)"
I found the wiki.openstreetmap blog entry, describing how to edit the osmconf.ini, but it also did not clarify things for me.
So my question is: Can I edit the osmconf.ini file in such a way that it only extracts major roads from the OSM-file or do I have to do this in a separate step in my sqlite-database and export it just then to QGIS?