I want to filter PBF file
for OpenStreetMap
by highways. For example highways = residential
. I'm novice in OpenStreetMap
. I read some info and start to use these tools to get results, they are osmfilter
, osmconvert
, osmosis
Stages:
1) I convert pbf-file to osm, for using it in osmconvert. For example:osmconvert norway.pbf >norway.osm
2) I filter osm-file via osmfilter, result file I get in pbf-format. For example: osmfilter norway.osm.pbf --keep="highway=primary =secondary waterway=river" >streets.osm
3) In final I process filtered pbf-file via osmosis
My problem is filtered pbf file is in an application/xml
format, but osmosis
works with pbf file which is in application/octet-stream
format. How to fix it? Or which filter methods are better? May be I need change application/xml
format to application/octet-stream
. How to do it?
osmosis can read XML and PBF files. Just use --read-pbf
for PBF files and --read-xml
for XML files.
Alternatively consider using osmium-tool instead. See the manual for filtering by tags.