Build a linestring based on ways that share a common tag

21 views Asked by At

I'm trying to build a unique object that gathers all ways that share a common tag. In my specific case, I'm trying to build a (multi-)linestring that gathers all ways that share the same name.

For instance, the way 8491160224 is part of a hiking trail, named Karamatura Track https://www.openstreetmap.org/way/849160224#map=19/-37.00049/174.54761

The Karamatura track is missing a relation that connects all its relevant ways, and I'd like to build this relation locally and eventually extract its geometry as a (multi-)linestring geojson feature.

I've managed to extract all ways from osmium (based on a defined bbox), filter them by their name and then reconstruct a multilinestring - the problem with this approach is that sometimes I end up reconstructing ways that are not connected, but that are only sharing the same name (with one way being a few hundred km from the others - it only means that 2 hikes are sharing the same name in 2 different part of the world - but they're not connected otherwise).

Each way is sharing a node with its neighbour it's connected to, so I assume that there should be a way to reconstruct this relation using osmium (by extracting the "part of way.." information)

enter image description here

I can't find an easy way at the moment on how to efficiently collect this information and post-process it once my handler is ready.

Any guidance would be much appreciated

0

There are 0 answers