Filters in osmfilter; a lot of unwanted data
I want to filter the national borders of the countries in Europe, thus admin_level=2. I composed the following query for OSMfilter (the chevrons allow to feed multiple lines into the Windows Command Prompt)
osmfilter ^
--verbose ^
"D:/GIS Data/Data/europe-latest.o5m" ^
--keep-relations="boundary=administrative AND admin_level=2" ^
--keep-nodes= ^
--keep-ways= ^
-o="D:/GIS Data/Tijdelijk/countrieseurope.osm"
When I convert/import this file (~ 970 MB) using either osm2pgsql or ogr2ogr, the countries are rendered correctly. But there are also al lot of boundaries from provinces and municipalities (admin_level > 2) rendered. The happens for instance in Spain, Portugal and Belgium; thousands of local boundaries are rendered. On the other hand for instance in The Netherlands, Slovenia and Norway only the national borders are rendered (which is correct).
It seems to me both osm2pgsql and ogr2ogr are rendering the OSM file correctly (checked the OSM file manually). So the data of the unwanted local boundaries have to be in the OSM file extracted with OSMfilter. Then I executed the following query:
osmfilter ^
--verbose ^
"D:/GIS Data/Data/europe-latest.o5m" ^
--keep-relations="boundary=administrative AND admin_level=2" ^
--ignore-dependencies ^
-o="D:/GIS Data/Tijdelijk/countrieseuroperelation.osm"
This yields an OSM file with relations of the national borders of about 60 countries, which is correct. So it seems to me the unwanted data is filtered when OSMfilter is resolving the child relation, relations, ways and nodes of these 60 relations. Why is this unwanted data included by OSM filter? Should I change my query?
query? Or is perhaps the data insufficiently tagged in some countries (as the problem only occurs in about half of the countries).
BTW: This question is related to my question about [Osmosis][1]. I tried to do the same query in Osmosis to see if the dependencies on the 60 relations are resolved in another fashion by Osmosis.
[1]: https://help.openstreetmap.org/questions/47931/filters-in-osmosis-filtering-administrative-boundaries