NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

If I remove all the ways (2, in this case) from a relation, does the relation automatically get deleted?

I needed to basically 'merge' 2 route relations, but it was easier to just remove the 2 ways that were in the wrong relation and add them to the right one, then delete the empty relation. But after removing the 2 ways, I couldn't see any way to select the empty relation. Looking at the changeset information later, it looks like it got deleted automatically. Is this correct?

asked 11 Sep '16, 01:33

ljb_nj's gravatar image

accept rate: 12%


I would like to see some wiki page on the topic of editing existing relations, in JOSM. I always feel like I am screwing them up, and when I try to delete them entirely, I often get errors that have me poking around trying to fix it. I hope someone answering this question can point us to a good online tutorial.

(11 Sep '16, 03:25) mtc

If you think it's worth creating a wiki page about something then obviously go ahead and create it - it's a wiki!

If you want to go through various drafts and get other people's opinions on it before making it "live" then create it below your user account and ask for feedback on it first.

(11 Sep '16, 10:09) SomeoneElse ♦

With SimonPoole's hint, I looked further at the specific editor, and found this iD issue: "What to do with emptied relations".

The resolution of that issue was that iD does delete any relation that becomes empty.

(11 Sep '16, 15:48) ljb_nj

The OSM API does not delete empty relations*. Depending on what you are using your editor may do so, but I'm not aware of one that does. A warning is clearly in order, auto-deleting is probably not (there are a couple of reasons why you temporarily might want to keep an empty relation around).

Relations are really easy, they are simply lists of other OSM objects.

Difficulties happen because some times they are very large (and very large lists are hard to manipulate in any medium) and when there are complicated implied or explicit rules in the tagging scheme that define the required relationships between the objects in the relations.

JOSM has of late started popping up relation related error messages that are a nuisance and are not really helpful. Typically for example when splitting a way you want the resulting two parts to remain in the relation except if the relation in question is a turn restriction. This however can easily be handled by the editor without involving the user at the time they are splitting the way.

(* empty relations have no associated geometry and as such will not be retrievable except if their id is known once they are stored in the database, so in general they are useless.)

permanent link

answered 11 Sep '16, 08:53

SimonPoole's gravatar image

SimonPoole ♦
accept rate: 18%

edited 11 Sep '16, 09:00


I'm using iD (I put that in the tags, but I should have mentioned it too).

Here is the changeset:

I deleted all (2) ways from this relation:

The history of that relation is that it used to have 2 member ways:

I'm pretty sure I just removed the relation from both those ways, but did nothing to delete the relation. Yet the changeset says the relation was deleted. Perhaps iD did that?

I agree that in general automatically deleting a relation that becomes empty would be a bad idea. But perhaps it makes sense for iD, given the typical user base (such as me).

(11 Sep '16, 15:21) ljb_nj

The wiki has a useful article about empty relations, including a link to a tool that lists them, and some hint on why they appear and how to handle them. Info about iD is currently missing, if you use that editor please update the wiki page.

(12 Sep '16, 09:14) Vincent de P... ♦

Yes, iD does delete the Relation when it no longer has any members.

see: delete_member.js and relation.js#isDegenerate

permanent link

answered 18 Sep '16, 02:49

bhousel's gravatar image

accept rate: 38%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 11 Sep '16, 01:33

question was seen: 3,115 times

last updated: 18 Sep '16, 02:49

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum