OSM Waterway analyses
This check creates listings of all OpenStreetMap waterway relations.
The waterways are listet in flat and hierarchical order. One tree of such a hierarchical waterway list is a watershed.
The script (see. technical details) also traces all connected waterway way segments.
Results for different areas
For the whole planet: flat list, hierarchical list, hierarchical list with wikidata
For all contries see last column of this wikidata/osm list
The results can be used to improve osm data and wikidata objects. While fixing some missing connections,
I've seen different reasons, why two waterway relations are not connected:
- incomplete relations: not all way elements are part of the relation
- waterway connected to riverbank: the waterway of the tributary ended at the riverbank and not on the next waterway way
- missing waterway tags on the relation members: In france some boundaries ways are part of the waterway relations but don't have a waterway tag.
- Connection outside the area: If the analyses is run on single countries, then two rivers might be connected outside the data extract.
technical details
Two ways are connected by nodes. The flow direction can be determind by the position of the connection nodes in the way.
Example: The endpoint of one waterway is connected to the start or mid point of a second waterway. Thus way one flows into the second waterway.
With that information you can create a table with all flow direction information of the ways.
With that, you can find out which waterway relation flows into another.
And finally traverse the connected waterways and build wateshed trees.
Sources
You can find the source code on github: https://github.com/werner2101/osm-tests
ideas for improvements
- trace connections between ways that are not member of relations, too (DONE)
- take care of flow directions (DONE)
- create the listings for the whole planet and not only on single countries (DONE)
- use a database instead of the existing simple scripts (partly DONE)
- use waterway / coastline connections as starting points of watersheds (currently done with a configuration script)
- natural=water between waterways can break the watershed
- better handling of waterways that distribute water
Werner Hoch
Last modified: 2019-12-28