I am using the following lines to catch a whole river (main stream, side streams and tributaries):
For "simple" rivers that works fine as long as all parts of the river are added to the relation of this river or as long as they have this river stated as destination, e.g. for tributaries. However, many rivers have larger tributaries that form own relations. For example, the biggest tributary of Luleälven (https://www.openstreetmap.org/relation/6974663) is Lille Luleälven (https://www.openstreetmap.org/relation/12802656). Lilla Luleälven has a couple of tributaries on its own. As long as the relation "Lilla Luleälven" is tagged as "destination=Luleälven" it works fine with the code above. What does not work is when more levels are added. E.g. if one wants to capture tributaries of the tributary. Ráhpaädno (https://www.openstreetmap.org/way/30833503) which first passes one big lake and one big reservoir before it comes close to yet some other lakes from where one starts calling the river Lilla Luleälven. In this case, the name of the nearest lakes or "Lilla Luleälven" would be a good choice for destination, not "Luleälven" or "Baltic see". (I am sure there are more and better examples.) Is there any way to select a whole river system in Overpass using the relations that are defined for rivers in a recursive way? For example a command that adds all tributary relations of a river to the main river including the tributaries of the tributaries? That would be great! All solutions and ideas are welcome, thanks in advance! asked 20 Aug '21, 14:11 Gåseborg |
There is a convenient solution using the block statment complete and a recourse filter:
This way, it is not important to tag tributaries with destination, they only need to be connected with the main river (or yet another tributary) at their confluence. A very nice function of Overpass! I am happy :) What it does (at least as I understand it): Starting with the relation of the main river (Luleälven in this case), way(r) collects all ways that are members of this relation and node(w) collects all nodes that are members of the these ways. Then, way(bn) finds all ways linking to these nodes - these ways are the parts of tributaries closest to the confluence - and, finally, rel(bw) gets all relations linking to the just found ways, i.e. the relations of the tributaries, in our case Lilla Luleälven. For more information, check: answered 06 Sep '21, 18:11 Gåseborg |