Findings rivers that you can add to a waterway relation
Posted by amapanda ᚛ᚐᚋᚐᚅᚇᚐ᚜ 🏳️⚧️ on 15 April 2016 in English.Waterway relations
The waterway=river
tag is used in OSM on ways that make up a river. Like many things in OSM, an actual river will almost certainly be split up into many individual ways. Luckily there is a waterway
relation. You can create one relation for each actual river, and then add all the ways that make up the river into that relation. Data consumers can then easily work with one object for a river and reason about it. (e.g. How long is it? What countries is this river in? What other rivers flow into it?)
Using Overpass to find missing waterway relations
Adding rivers to the relation is easy enough. But how do you know how to find them? Overpass Turbo can be used for that.
This overpass query will show you all the rivers in a bbox which are candidates for a waterway relation:
[out:json][timeout:250];
(
// all ways that are tagged river, and have a name
way["waterway"~"(river|stream)"]["name"~"."]({{bbox}});
-
// minus all the ways that are in a relation
( relation["type"="waterway"]({{bbox}}) ; > );
);
// print results
out body;
>;
out skel qt;
It find all ways with the waterway=river
or waterway=stream
tag, that also have a name
tag, and it excludes all ways that are already in a type=waterway
relation.
Loading into JOSM
When you have run that query in Overpass Turbo, you can export the result to JOSM using the remote control feature of JOSM.
However JOSM has a very useful “Download from Overpass API” feature for loading data direct into JOSM, if you want to avoid your browser having to load and display a massive amount of data. However you must use a slightly different overpass format. Instead of {{bbox}}
use bbox
. This is the query you need for JOSM:
(
// all ways that are tagged river, and have a name
way["waterway"~"river|stream"]["name"~"."](bbox);
-
// minus all the ways that are in a relation
( relation["type"="waterway"](bbox) ; > );
);
// print results
out meta;
>;
out meta;
Examples
Some examples of waterway relations:
Discussion
Comment from Taz60 on 16 April 2016 at 08:25
That’s weak like yourself
Comment from Marcos Dione on 16 April 2016 at 14:36
What about just extending a previously existing relation? Should we just remove the filter in the second line? Another thing very common in Europe is very long rivers that go through several countries, hence having different names. The most clear example, the Danube, has all these names:
Comment from Marcos Dione on 16 April 2016 at 14:56
Also, what’s the name of the plugin who provides this?
Comment from amapanda ᚛ᚐᚋᚐᚅᚇᚐ᚜ 🏳️⚧️ on 18 April 2016 at 08:44
That feature should be in JOSM without needing any plugins I think? Maybe you need to turn on “Expert mode” in the settings to see it?
Comment from amapanda ᚛ᚐᚋᚐᚅᚇᚐ᚜ 🏳️⚧️ on 18 April 2016 at 08:59
I’m not sure what you mean. This overpass query is for finding new, un-relation’ed, rivers. If there’s an existing waterway relation which is missing some parts, then yes, you should add those ways to the correct relation.
The Danube is already mapped as a relation in OSM: Relation 89652. It has all the appropriate
name:XX
multilingual tags, however thename
tag is set to “Donau”. I’m unsure if that’s correct, but I’m unsure what a correct name tag should be.