osmcode / libosmium

Fast and flexible C++ library for working with OpenStreetMap data.
https://osmcode.org/libosmium/
Boost Software License 1.0
465 stars 113 forks source link

Missing area when using libosmium #327

Closed patrickbr closed 3 years ago

patrickbr commented 3 years ago

We are using libosmium to parse the latest freiburg-regbez-latest.osm.pbf from Geofabrik. We noticed that the following type=boundary relation (the border of the Freiburg Regierungsbezirk) is not passed through as an osmium::Area object with a MultiPolygon geometry, but only as an osmium::Relation object:

https://www.openstreetmap.org/relation/2106112

According to our understanding, type=boundary relations should be recognized as an area. This indeed works as expected for other boundary relations.

We have noticed that the boundary polygon has multiple outer rings, and a single inner ring. Is this combination problematic?

ImreSamu commented 3 years ago

@patrickbr

maybe missing ways ?

Did not find 9 object(s). Missing way IDs: 61049227 61191061 78756557 78756569 79096146 81763605 377854540 385893358 385893360

$ osmium getid freiburg-regbez-latest.osm.pbf r2106112 \
>   --add-referenced --overwrite --verbose-ids --output r2106112.osm.pbf
[ 0:00] Started osmium getid
[ 0:00]   osmium version 1.12.1 (v1.12.1-6-g3182275)
[ 0:00]   libosmium version 2.15.6
[ 0:00] Command line options and default settings:
[ 0:00]   input options:
[ 0:00]     file name: freiburg-regbez-latest.osm.pbf
[ 0:00]     file format: 
[ 0:00]   output options:
[ 0:00]     file name: r2106112.osm.pbf
[ 0:00]     file format: 
[ 0:00]     generator: osmium/1.12.1
[ 0:00]     overwrite: yes
[ 0:00]     fsync: no
[ 0:00]   other options:
[ 0:00]     add referenced objects: yes
[ 0:00]     remove tags on non-matching objects: no
[ 0:00]     work with history files: no
[ 0:00]     default object type: node
[ 0:00]     looking for these ids:
[ 0:00]       nodes:
[ 0:00]       ways:
[ 0:00]       relations: 2106112
[ 0:00] Following references...
[ 0:00]   Reading input file to find relations in relations...
[ 0:01]   Reading input file to find nodes/ways in relations...
[ 0:01]   Reading input file to find nodes in ways...
[ 0:02] Done following references.
[ 0:02] Opening input file...
[ 0:02] Opening output file...
[ 0:02] Copying matching objects to output file...
[======================================================================] 100% 
[ 0:02] Closing output file...
[ 0:02] Closing input file...
[ 0:02] Did not find 9 object(s).
Missing way IDs: 61049227 61191061 78756557 78756569 79096146 81763605 377854540 385893358 385893360
[ 0:03] Peak memory used: 1405 MBytes
[ 0:03] Done.
ImreSamu commented 3 years ago

imho: baden-wuerttemberg-latest.osm.pbf looks OK. - no missing way IDs

$ osmium getid baden-wuerttemberg-latest.osm.pbf r2106112 \
>   --add-referenced --overwrite --verbose-ids --output r2106112.osm.pbf
[ 0:00] Started osmium getid
[ 0:00]   osmium version 1.12.1 (v1.12.1-6-g3182275)
[ 0:00]   libosmium version 2.15.6
[ 0:00] Command line options and default settings:
[ 0:00]   input options:
[ 0:00]     file name: baden-wuerttemberg-latest.osm.pbf
[ 0:00]     file format: 
[ 0:00]   output options:
[ 0:00]     file name: r2106112.osm.pbf
[ 0:00]     file format: 
[ 0:00]     generator: osmium/1.12.1
[ 0:00]     overwrite: yes
[ 0:00]     fsync: no
[ 0:00]   other options:
[ 0:00]     add referenced objects: yes
[ 0:00]     remove tags on non-matching objects: no
[ 0:00]     work with history files: no
[ 0:00]     default object type: node
[ 0:00]     looking for these ids:
[ 0:00]       nodes:
[ 0:00]       ways:
[ 0:00]       relations: 2106112
[ 0:00] Following references...
[ 0:00]   Reading input file to find relations in relations...
[ 0:02]   Reading input file to find nodes/ways in relations...
[ 0:03]   Reading input file to find nodes in ways...
[ 0:05] Done following references.
[ 0:05] Opening input file...
[ 0:05] Opening output file...
[ 0:05] Copying matching objects to output file...
[======================================================================] 100% 
[ 0:09] Closing output file...
[ 0:09] Closing input file...
[ 0:09] Found all objects.
[ 0:09] Peak memory used: 1406 MBytes
[ 0:09] Done.
patrickbr commented 3 years ago

Wow, thanks for the quick answer, this seems to be the problem! I am including @lehmann-4178656ch, who is working on the code. To me, it seems like Geofabrik is using an incorrect polygon of the Freiburg Regierungsbezirk.