OpenStreetMap

Breaking route relations while splitting roads

Posted by Jothirnadh on 8 June 2017 in English. Last updated on 14 September 2018.

The most common error we end up doing while splitting well-mapped roads in a highly mapped area is by breaking a route relation. This usually involves breaking the continuity of a bus or highway route due to missing members. The community has reported broke route relations while the data team was trying to improve navigation features (Turn lanes & turn restrictions) in US cities. On thorough research found some points to share with you all and hope this helps in solving route relations breakages in future.

The first thing to note, there is nothing wrong with any of the split way or knife-tool that we use to split the road. In general, route relations are very long and spreads across the city. When two or more persons work at the same time, on editing roads part of the same route relation, JOSM will throw relation edit conflict. This conflict is very specific on which version of the edit to keep and which one to remove. In general, people tend to resolve the conflict by pushing their edits and skipping the other’s edits. This causes the route relation breakage. Let me explain clearly with examples.

Example:

For this use case, I took a bus route (Relation: 333P) in Bangalore, India and tried to download the data into JOSM at two corners of the route into two different layers (layer-1 & layer-2). Now the route relation 333P has 89 members at version-61.

Route Relation: 333P in Bangalore with the location of a road to split in layer-1 and layer-2

  • In layer-1 the road with route relation 333P is split at any node and uploaded to OSM. This will split the road into two segments, one with version 1 and other will continue with version n+1. As one road is split into two roads, JOSM will also add the new road segment into relation. Now we have 90 members in the relation and version is increased to 62.
  • Lets shift to layer-2 which is still in Version 61 & 89 members. Split a different road with route relation 333P into two segments. While uploading the data to OSM a conflict dialog box pops up with 1 conflict.

The OSM server rejects the upload since it has a newer version of the relation

  • We now need to merge the server version 62 with our version 61 before it can be uploaded to the server. In the resolve conflicts tab I selected my version of the relation to use for the merged result.

Current version (my edits) and OSM version in Resolve conflict tab

After pushing my current edits without considering the other version in OSM

  • Due to this, the JOSM will only keep the members that are split in layer-2 to the route relation 333P and remove one member (the road segment with version 1) that is added in layer-1 from the route relation. This will break the route relation.

How to avoid route relation breakages?

  • To avoid breaking the continuity in the relation, it is necessary to include the new members from both versions in the merged relation
  • Like previously, while resolving conflict in layer-2 and once we choose our version in Resolve conflicts window, JOSM will automatically freeze any more edits. But we still need to add the missing member from layer-1.

  • Now by clicking Unfreeze option at the bottom of the dialog allows us to continue to make changes to the merged version

  • Now the important part - Find the new member in the relation member list from the server version (Their version). The conflict dialog will highlight this is red to indicate that it is only present in this list. Select this member and add it to the merged version of the relation.

  • Now all the missing members are added to the relation. Click on Freeze → Apply Resolution → Upload to OSM. Check if the relation has any breakages (It should not anymore 😉)

Resolving relation conflicts can be challenging since it can be difficult to get the context of the edit in a list of object id’s. If JOSM can be intelligent enough to preserve the continuity of a relation over conflicting edits, then it can identify the missing member and add it to the relation without causing the relation to break. Want your ideas on how we can resolve this issue following a much simpler approach.

This is one case I came across and there might be many such cases where even inexperienced mappers may be unknowingly breaking relations if they are not familiar with proper conflict resolution. Please feel free to post your thoughts on this and share any easier workflow you may have to resolve such conflicts.

P.S. Always before uploading modified data into OSM check for their updates on OSM just by pressing ⌘+U for MAC, cntrl + U for Windows and Linux users (Update data) 🖐️

Happy mapping!

Location: Old Binnamangala, Bengaluru, Bangalore North, Bengaluru Urban, Karnataka, 560001, India

Discussion

Comment from ToniE on 8 June 2017 at 10:01

Hi Jothirnadh,

thanks for summarizing this. I have have stepped into this trap many times.

Also a good trap …

Downloading only the public transport relation and then try to split a way. This might end up in spoiling other relations that have not been downloaded so far.

Always download the surrounding data before splitting!

Another hint:

Have a look at JOSM ticket #14711: JOSM does not consider “oneway=yes” or “junction=roundabout” when sorting.

I’m currently working on a script for the analysis of public transport relations of a region/city/network. Kindly have a look at the Munich/Germany analysis: some parts are in German but errors (Fehler) and notes (Anmerkungen) are in English.

https://wiki.openstreetmap.org/wiki/M%C3%BCnchen/Transportation/Analyse

Best regards Toni

Comment from ToniE on 9 June 2017 at 09:30

… and another hint:

Exit the JOSM “relation editor” before splitting a way which is already member of that relation. Otherwise you will have to fight with conflicts.

Best regards Toni

Comment from Minh Nguyen on 12 June 2017 at 05:01

Relation Analyzer can be useful for detecting gaps in a route relation after the fact.

Comment from Jothirnadh on 12 June 2017 at 08:39

Thanks for your suggestions ToniE and Minh. Will try this out and post my findings soon :)

Comment from Polyglot on 14 June 2017 at 09:12

Hi, last year we created a plugin to help with keeping route relations sane. It’s called PT_Assistant. This year another student is working on it and it will be extended to bicycle and foot route relations.

What I do now, when working on a dataset for a longer time:

Update Selection If there are any conlicts, resolve them in favour of the last editor, instead of myself. Validate (either the route you want to work on, or everything, or use the upload button, but abort before actually uploading, this causes validation to be performed on everything that was changed) Use the validation warnings (and sometimes the fix button) to resolve continuity of the route relation. Put all the stops (platforms and/or stop_positions) to the beginning of the route relation Do a visual check of the continuity of the line Use the middle sort button, to sort members from the current position down (that’s the reason for putting the stops first)

Select the relation and use Upload Selection before doing more work. Find all that was modified and use Upload Selection again on everything that was not a relation in case more roads were split.

Your way works too, but I can’t get used to it, for some reason (perceived complexity).

Polyglot

Comment from Polyglot on 14 June 2017 at 09:14

ToniE,

I don’t exit the relation editor anymore, instead I use the lowest button on the middle button bar, to remove the selected members from the relation and save. Then I split the road and readd the part I wanted. Then I use the middle sort button on the left row of buttons to sort the relation members from that point on, downward.

Polyglot

Comment from ToniE on 14 June 2017 at 11:45

Hi Polyglot,

good point and less error-prone. I try to change my habit towards this - may take a while.

BTW: my Perl script will also check the sequence: stop/platform, … stop/platform, way,… , way

The original idea for the script was to have a wiki page, listing the state of all routes of a region/operator/network, so that we can easily check and start JOSM for those who show problems.

Toni

Comment from Polyglot on 14 June 2017 at 22:31

I’m not putting the stop_position nodes into the route relations, I hope it doesn’t hiccup on that.

Comment from ToniE on 15 June 2017 at 08:58

Good concern. Having stops and platforms is recommended, not mandatory.

I’ll change that to “all or nothing”: if there is at least one stop or platform, the full check for stops or platforms is started

  • first and last node of the entire way have to be stop positions of the relation, the first and last stop in the list.

  • stop positions have to be nodes of the ways.

  • stop positions have to be ordered respecting the way, i.e if I follow the entire way, I will pass stop#1, stop#2, … of the list of stops (ignoring all other stop positions on the way of course)

Toni

Log in to leave a comment