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!