Empty relations are OSM relation objects that have no members. Most time they have been created by accident. Here are some Informations about relations without members and the Quality assurance hints to fix/delete empty relations.
Why are there empty relations
There are several reasons how empty relations are created.
Created on purpose
Empty relations can serve a purpose if:
- they are members of another relation AND
- they have at least one tag.
In that case they can be thought of as complex, non-geographic objects. For example, assume you have three roads (each modeled as a relation grouping several ways), and these roads share a common operator. You could tag the three road relations with "operator=xyz limited". But what if "xyz limited" was a more complex object, consisting of a name, a telephone number, and a web site? You could then create a relation with no members, tagged name=xyz limited, telephone=xxx, website=yyy, and add that relation to the road relations as a member in the role "operator".
This is a complex but legitimate way of expressing information. Thus, do not assume that a relation without members is necessarily a bug!
Another reason for their existence is that these relations are still to be completed (such as boundaries): they should have at least one parent relation (of which they are a member), being part of a complete enumeration of known objects that are still to be completed. Such incomplete relations should have a fixme=* tag to explain their existence and what is missing in them. But it is still best to include at least one place node in them to geolocalise them properly, so that these relations will be loaded and visible in editors, because relations do not have themselves a geometry (relations are not found by loading the area where they should be present if they don't have any geolocalized members).
Relation creation without members
- accidental creation (mostly by new users)
- creation of place holders, that will be edited later. E.g. a bunch of bus routes where members are added later.
This relations very often have a version number 1.
A mapper deletes the last member or removes all members (in the case of the object disappearing from the real world), but does not delete the relation itself.
Wrong merge conflict resolution
Two users edit a relation at the same time. This raises a merge conflict. Not all mappers are familiar with resolving such conflicts, and it might happen that all members are removed. The conflict resolution dialog of JOSM displays an empty member list as default. Not all users are aware of that.
Note: The object version of those relations is at least 3.
Large amount of empty relations are the result of automatic imports.
How to fix the empty relations
First, you need a way to access the empty relation to be able to edit it. Issue: Relations without members don't have a place where they are. So, you can not load them with a bbox selection directly in the OSM editors.
- JOSM: You need to download them with the OSM API using JOSM/Plugins/RemoteControl or object download by ID.
- Potlatch 2:
- Select some way to be used as a temporary member of the empty relation.
- Switch to advanced view.
- Click "Add to" below the relations list.
- Use the "Load Relation..." to provide the relation id.
- Delete the relation using its drop-down menu.
- iD: The iD editor automatically deletes a relation if it becomes empty because its last member was deleted. See the iD issue What to do with emptied relations. This means if you are using the iD editor, you will not create empty relations.
You can try to find out why the relation is empty. Some methods to do that are:
- look at the changeset comment of the last edit. If the mapper writes that he was doing some cleanups it's very likely that he just forgot to delete the relations, too.
- look at the mapper statistic to find out, whether it's a new user who might have accidentally created the relation.
- look at the history of the relation.
- look if there are many similar empty relations by the same user. This relations might be a result of bad imports.
- ask the mapper who created the empty relation
Finally you can decide what to do with the relation:
- restore old revision
- delete the relation
- just do nothing
osmium cat my_openstreetmap_data.osm.pbf --no-progress -t relation -f opl | grep " M$"