Josm - how to add a way to a relation?

Imagine I’ve got this situation:

I’d like to edit the relation to fill in the gap. If I edit that area in JOSM I see this:

What I’m trying to do is select the road, click “add to relation”, see nearby relations and pick the appropriate one (the way that most other OSM editors work).

What I’m trying to avoid is hunting around among the 82 relations until I find the one I want to edit, then select “edit relation” and add the (hopefully) previously-selected road to it. The reason why I definitely want to do it this way around is that often one road needs re-adding to many relations - the road is the object that I’m mainly working with, not the relations.

1 Like

Does the Relation Toolbox plugin give you the workflow you want?

  1. Select the bit of way. The current “memberships” then show in the toolbox.
  2. Click on “:mag:Find” in the bottom right corner of the Relation Toolbox.
  3. Select the correct relation from the list then click OK.
  4. Click :heavy_plus_sign: to add the pre-selected bit of way to the relation with an empty role.
  5. Select the correct role from the drop-down next the the :heavy_minus_sign: (where the relation description was shown during step 4).

This doesn’t really skip the “hunting around 82 relations until I find the one I want to edit” bit though. If you know the next way along will contain the relevant relations you can temporarily select that to populate the (shorter) list of relations used by that way in the toolbox, use that list to select the correct relation then deselect the extra bit of way and go to step 4.

What you can do is select all the relations you want to add the way to from an adjacent way (in the tag list → context menu → select in relations list), then select the way itself and use the ‘add selection to relation’ action from the relations list context menu. Unfortunately that will only add the way as the last member and not in sorted order.

Peek 2024-03-03 05-12

In such situations I would ‘cheat’ extend / merge the missing segment to the previous one and then split again, then if necessary remove the way from any relations it shouldn’t be a member of. Doing it this way has the advantage of keeping the ordering of the relation members correct.

PS: naturally I wouldn’t actually do that as I would be using Vespucci to start with :wink:

Answer for the question with one relation

(if several relations have the identical gap, see below)

  1. Copy the URL of the relation including the BBOX to buffer
  2. In JOSM “Download Object” (Ctrl+Shift+O) without referrers and without members (unchecked first two checkboxes) to a new layer
    • As “Download Object” automatically past from buffer the relation should already be chosen in the first two drop downs
  3. Select the relation in relation list panel (you might need to open the panel under the “Window” menu or use “Atl+Shift+R”)
  4. Open download dialog (Ctrl+Shift+“down arrow”) and past from buffer and download the BBOX
    • Again the BBOX from buffer is used to directly find the area to download
  5. Select the relation using the select button from relation list panel to find the gap
  6. Select the ways of the gap plus the first way with membership on both sides of the gap
  7. Open the relation editor for the relation using the second button from the left in the relation list panel
    • Hopefully the relation members are not totally out of order and you find a picture like below with the two selected members next to each other on the left side
  8. Select the last of the two members on the left side (Members) and add the missing ways with the second button in the middle button panel “Add all objects selected in the current dataset before the first selected member”
    • As only the missing ways should be added from the selection select “Do not show again (this operation)” and then click on the “No” button in the new dialog
  9. If the newly added ways are in the wrong order they need to be reversed with “Reverse the order of the relation members”
  10. Save the relation by closing the relation editor clicking on “OK” at the bottom.

Now we have fixed one relation but this might not the only relation with this identical gap as often more or all relations sharing the ways were damaged with the CS which introduced the gap. It might to be a good idea to fix all and even to take a look at the history of the ways forming the gap to find the responsible CS and nicely inform the responsible user about the problem.


General answer for multiple relation with the identical gap

  1. Copy the URL of the relation including the BBOX to buffer
  2. Open download dialog (Ctrl+Shift+“down arrow”) and past from buffer and download the BBOX
  3. Select the last way before the gap on both sides
  4. In the Tags/Memberships panel in the bottom part below the tags select all (route) relations which are parents of both ways using the third column “Position” and all rows without an X.
  5. Use the panel context menu’s “Select in relation list”
  6. In MapView select one of the member ways at the gap and all missing ways forming the gap
  7. Open an relation editor for each relation using the “Edit” button (second from the left) in the relation list panel
    • As this might need a lot of resources if many relations are involved a warning is shown and it might be wise to only deal with ten relations at a time.
  8. In relation editor add the missing ways with “Add all objects selected in the current dataset before the first selected member” respectfully “Add all objects selected in the current dataset after the last selected member” (second or third button in the middle button panel (Selection)).
  9. If the newly added ways are in the wrong order they need to be reversed with “Reverse the order of the relation members”
  10. Save the relation by closing the relation editor clicking on “OK” at the bottom and continue with the next relation editor at 8. until all are closed.