**Another update:**
I got Osmosis working in the correct fashion (for the solution see: https://help.openstreetmap.org/questions/47931/filters-in-osmosis-filtering-administrative-boundaries ), so now I can compare the results of Osmosis to the results from OSMfilter.
I downloaded the Geofabrik file of Portugal as Portugal got improperly filtered by OSMfilter (see above). I filtered for boundaries=administrative AND admin_level=2.
OSMfilter:
osmfilter ^
--verbose ^
"D:/GIS Data/Tijdelijk/portugal-latest.o5m" ^
--keep-relations="boundary=administrative AND admin_level=2" ^
--keep-ways= ^
--keep-nodes= ^
-o="D:/GIS Data/Tijdelijk/portugaladmin2osmfilter.o5m"
Osmosis (3 separate steps):
osmosis ^
--read-pbf-fast workers=2 "D:/GIS Data/Tijdelijk/portugal-latest.osm.pbf" ^
--tf accept-relations boundary=administrative ^
--tf accept-relations admin_level=2 ^
--write-pbf file="D:/GIS Data/Tijdelijk/step1.osm.pbf"
osmosis ^
--read-pbf-fast workers=2 "D:/GIS Data/Tijdelijk/step1.osm.pbf" ^
--used-way ^
--write-pbf file="D:/GIS Data/Tijdelijk/step2.osm.pbf"
osmosis ^
--read-pbf-fast workers=2 "D:/GIS Data/Tijdelijk/step2.osm.pbf" ^
--used-node ^
--write-pbf file="D:/GIS Data/Tijdelijk/step3.osm.pbf"
Using Osmosis the problem is gone**!** Osmosis correctly resolves the necessary child-ways and child-nodes for rendering the relations with boundaries=administrative AND admin_level=2, while OSMfilter also resolves parent-relations of child-ways and parent-ways of child-nodes, leading to much unnecessary data being selected. This becomes evident when comparing the file sizes.
File sizes:
- Osmosis method (OSM file format): 1536 kB
- Osmfilter method (OSM file format): 61568 kB
BTW: Any ideas to improve the rather tedious Osmosis method I used? :)