osmcode / osmium-tool

Command line tool for working with OpenStreetMap data based on the Osmium library.
https://osmcode.org/osmium-tool/
GNU General Public License v3.0
483 stars 104 forks source link

osmium extract - how to include intersecting ways without nodes? #246

Closed mschilde closed 1 year ago

mschilde commented 2 years ago

What version of osmium-tool are you using?

osmium version 1.14.0
libosmium version 2.18.0
Supported PBF compression types: none zlib lz4

What did you do exactly?

First of all, many thanks for developing the osmium tool, I'm a happy user!

I'm trying to extract ways that intersect or are inside a polygon from an OSM PBF file. This works usually really well, but in some edge cases I'm running into problems. Sometimes a way is not included in the extract even though it intersects the polygon.

My assumption is that a way is not included in the extract if it intersects with the polygon, but has no nodes inside the polygon. Is this assumption correct, and maybe fixable? :-)

The actual test data is too large to just paste here, but a test case would be:

https://www.openstreetmap.org/relation/1155947 (shape defines the polygon)

https://www.openstreetmap.org/way/129820188 (I would expect this way to be included in an extract)

I can provide more data if needed.

joto commented 2 years ago

My assumption is that a way is not included in the extract if it intersects with the polygon, but has no nodes inside the polygon. Is this assumption correct, and maybe fixable? :-)

Yes, your assumption is correct. And no, this is not fixable. Fixing this would require us to build real geometries from the OSM data for everything to create the extracts which is a huge effort compared to what we do now.

Workaround: Use a slightly larger extract.