[talk-ch] Cyclic relationships

Sascha Brawer sascha at brawer.ch
Tue Nov 1 23:29:16 CET 2022


Hi all

While writing some program that works with OSM relations, I found cycles in
the containment graph. For example, relation/2913585
<https://www.openstreetmap.org/relation/2913585> is part of
relation/12762833 <https://www.openstreetmap.org/relation/12762833>, which
is again part of the same relation where we started. If a naive
implementation were to traverse this relationship graph, it would run into
an infinite loop. This isn’t a serious problem though; checking for cycles
is easy enough. But it seems like a particularly interesting type of
tagging mistake, so I thought why not share the fun with you.

In Switzerland, there’s currently three such cycles:
relation/2913585 <https://www.openstreetmap.org/relation/2913585> ⟶
{relation/12762833, relation/12762834} ⟶  relation/2913585
relation/4012524 <https://www.openstreetmap.org/relation/4012524> ⟶
{relation/12762831, relation/12762832} ⟶  relation/4012524
relation/9202820 <https://www.openstreetmap.org/relation/9202820> ⟶
 relation/13987412 ⟶  relation/9202820

Best,

— Sascha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.ch/pipermail/talk-ch/attachments/20221101/90637d3f/attachment.htm>


More information about the talk-ch mailing list