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

How do I filter a given relation to only keep its members that have specific tag? For instance I have a bad relation of a river that contains both river itself and also riverbank... I want to get rid of the riverbank - that means to keep members that have waterway=river and drop members that have waterway=riverbank tags.

asked 25 Dec '11, 23:48

Kozuch's gravatar image

Kozuch
1.7k587285
accept rate: 8%

edited 28 Dec '11, 16:37


Assuming you know the relation id:

a) load JOSM

b) File, Download Object - select relation and enter the id. Don't forget to also download relation members

c) Use Edit, Search (or Ctrl-F) and enter child(type:relation id:<id>) waterway=river but replace <id> with the id of the relation

This selects the children (the way members) of the relation with the id <id> but only where they have the tag waterway=river. You might instead want to search for the relation members that have waterway=riverbank tagged, so you can then remove them from the relation in one go. If so just replace waterway=river with waterway=riverbank and once they are selected you should be able to remove them from the relation by selecting the relation entry in the properties panel and clicking the dustbin icon.

permanent link

answered 26 Dec '11, 10:21

EdLoach's gravatar image

EdLoach ♦
19.5k16156280
accept rate: 22%

The problem is the relation is too large and JOSM returns "Internal server error" (so does web front end). Is there a way to import the relation to JOSM in .osm XML format? I have the .osm file for that relation...

Edit #1: Well I just tried to load that file into JOSM but I can not see any data imported (nothing showing in map screen). Does JOSM need nodes to be contained within the .osm file? My file only contains members of the relation (=IDs of ways).

Edit #2: I see the relation loaded but was "incomplete", so nothing showed. So I just downloaded the members and now its OK.

(26 Dec '11, 21:56) Kozuch

I've had that with a few relations recently, and used the download incomplete option you have already found (this seems slower, but more reliable).

(28 Dec '11, 11:30) EdLoach ♦
Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×622
×236
×101
×18

question asked: 25 Dec '11, 23:48

question was seen: 6,184 times

last updated: 28 Dec '11, 16:37

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