[OSM-dev] Recursive relations

Andrew M. Bishop amb at gedanken.demon.co.uk
Mon Sep 14 10:17:47 BST 2009

Shaun McDonald <shaun at shaunmcdonald.me.uk> writes:

> On 13 Sep 2009, at 10:56, Andrew M. Bishop wrote:
>> In OSM a relation can contain other relations but it seems that there
>> is nothing to check that a relation doesn't contain itself.  I can't
>> think of any legitimate reason that it should be allowed though.

> From a data and technical point of view this has always been possible  
> in the API intentionally. It's just that no one has come up with a  
> good use for it yet.

Since I can't see any purpose that it can serve for a route or a
boundary I have edited the relations listed in my original e-mail and
removed the self-recursion.

As others have pointed out JOSM warned me that the relations were
self-recursive when I edited them and offered to automatically fix the
problem.  The JOSM validator doesn't check for this condition though.

For reference I created two changesets, one for route relations 12179,
15852, 80545, 101440, 163368, 165638, 167468, 170290 and one for
boundary relation 57535.  There are no other self-recursive relations
within the UK.  For the route relations the changeset is 2478746 and
for the boundary relation the changeset is 2478757.

>> Within the UK alone the following route relations all contain
>> themselves:
>> 12179
>> 15852
>> 80545
>> 101440
>> 163368
>> 165638
>> 165638
>> 167468
>> 168189
>> 170290
>> 170290
>> Also within the UK there is one boundary relation that contains
>> itself:
>> 57535

Andrew M. Bishop                             amb at gedanken.demon.co.uk

More information about the dev mailing list