Overpass query example

Rivers of a country

Draw the river network of a country from its waterway lines. Example: Slovenia.

Rivers are lines tagged waterway=river along the middle of the river bed. Smaller streams are waterway=stream.

The query

[out:json][timeout:60];
area["ISO3166-1"="SI"][admin_level=2]->.si;
way["waterway"="river"](area.si);
out geom;

Run it

Running the query…

Live result from overpass.ch, cached for up to 12 hours. Map data © OpenStreetMap contributors (ODbL).

How it works

  1. A river is split into many ways; the name tag tells which river each belongs to.
  2. The water surface is mapped separately as an area (natural=water with water=river).

Variations

  • A whole river as one object: rel["waterway"="river"]["name"="Sava"]; out geom;.
  • Rivers and streams: ["waterway"~"^(river|stream)$"] (much bigger).

Run it from your code

curl https://api.overpass.ch/v1/YOUR_API_KEY/interpreter \
  --data-urlencode 'data@query.overpassql'

Save the query as query.overpassql. It works the same in Overpass Turbo, QGIS and JOSM.

More examples

All examples →