I am currently trying to extract road networks from OpenStreetMap dumps downloaded on Geofabrik. I am using the following osmosis (version 0.45) command to extract roads:
osmosis \ --rbf input.osm.pbf \ --tf reject-relations \ --tf accept-ways highway=motorway,motorway_link,trunk,trunk_link,primary,primary_link,secondary,secondary_link,tertiary,tertiary_link,unclassified,residential \ --tf reject-ways highway=construction \ --lp --wb output_roads.osm.pbf
This should return a file containing all car roads except service roads.
However, some (and sometimes a lot of) roads are missing. I have tried this command on 3 input files:
- "Midi-Pyrénées" French region: the road network seems almost complete. The attribute table contains 72010 elements.
- all of France: a lot of roads are missing. The attribute table contains only 65803 elements (less than a single region). All types of highways are impacted: primary to residential. There is no any obvious pattern for the missing roads.
- all of Europe: almost all roads are missing. The attribute table contains 62092 elements (less than all of France...).
I guess there is some limitation I am not aware of, either on the osmosis command or on the output file. What am I doing wrong here?
This may be unrelated but I have tried using the
--used-node option in order to reduce the size of the output files, but this always generates an error (
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to create object stream writing to temporary file null.). I have no idea why.
Update 29/08/2018: I also tried using
input.o5m --keep="highway=" > output_roads.osm), with the same results. I tried osmosis and osmfilter both on Windows 7 and Debian 9.5 (both 64 bits).