Cleaning up large, untagged ways

Posted by richlv on 22 February 2022 in English. Last updated on 23 February 2022.

Sometimes one might want to clean up some features in OSM - for example, untagged ways that are not members of any relations. Such ways sometimes are left behind by wide-sweeping but perhaps less careful changes to forests and other areas. If such ways are short, it’s easy - but if they are very large, downloading a huge area in JOSM is not the best approach.

As I tend to forget the process to do this, documenting it here.

Knowing the object (way) ID, we can use the “File -> Download object…” functionality (Ctrl/Cmd+shift+o):

That opens the object download dialogue, where the way ID is pasted and “Object type” is set to “way”:

After downloading the object, we could delete it and upload our changes… but with long ways it will likely fail, as some nodes from this way are used by other ways. Even though the object download dialog has a “Download referers” option, that only handles parent relations. There’s even an explicit note about this in the “Download object” documentation page.

So how could we also get all the ways that include any of the nodes in our way to be deleted?

  1. Select the way and choose “Selection -> Adjacent nodes” (e).
  2. Select “File -> Download parent ways and relations” (Ctrl+alt/opt+d).

Another option would be to use object downloading dialog in step two again - with nodes selected, it attempts to auto-populate the “Object ID” field (big thanks to kaptaptuka from #osm for this tip). Unfortunately, that fails with many nodes.


Comment from ElliottPlack on 23 February 2022 at 03:16

Thanks for this useful tip richlv!!

Comment from PierZen on 28 February 2022 at 14:34

@richlv to test if less careful changes to forests and other areas, a first step would be to search OSM history using overpass with the [date: YYYY-MM-DDT00:00:00Z’] parameter to assure the way was not previously a relation member.

Comment from richlv on 1 March 2022 at 08:38

Yes, that’s a good hint. In the case I was looking in, most of the areas had been re-traced already, with those ways providing no benefit.

Comment from SomeoneElse on 5 March 2022 at 11:52

Beyond the technical part described here, I’d also try and understand the history - Who added it and why? What were they actually trying to do? Do they need help? In many cases of course it’ll be pretty obvious that things like this simply no longer add value, and have long been remapped as something else.

Comment from drolbr on 7 March 2022 at 10:13

If you do not know the id of the object, then you can selective download all ways: * use the expert mode * go to “File > Download data … > Download from Overpass API” * use the following query to get all ways that are not members of a relation plus all connected ways:

(._; - way(r.r); );
out meta;

Then use in “Edit > Search …” the search criterion:

type:way untagged -child type:relation

This way, the ways without tags and not being part of a relation are marked and the ways necessary to avoid deleting used nodes are present but not selected.

Comment from richlv on 8 March 2022 at 14:11

SomeoneElse, indeed, that’s a good point. In this case most of those ways were leftovers from a foreign mapper who had enthusiastically deleted many forest areas, but apparently had not paid attention to detail.

drolbr, a great tip, would indeed be very helpful when one might not know way ID beforehand.

Login to leave a comment