Better river styles with tapered lines

In 2012 I published a post on mapping the then newly released Tirol river dataset.

In the comments, reader Michal Zimmermann asked:

Do you think it would be possible to create a river stream which gains width along its way? I mean rivers are usually much narrower on their beginnings, then their width increases and the estuary should be the widest part, right?

For a long time, this kind of river style, also known as “tapered lines” could only be created in vector graphics software, such as Inkscape and Illustrator.

With the help of geometry generators, we can now achieve this look directly in QGIS:

Data cc-by Land Tirol

In the river dataset published by the state of Tirol, all rivers are digitized in upstream direction. For this styling to work, it is necessary that the line direction is consistent throughout the whole dataset.

We use a geometry generator symbol layer to split the river geometry into its individual segments:


Then we can use the information about the total number of segments (accessible via the expression variable @geometry_part_count) and the individual segment’s number (@geometry_part_num) to calculate the segment’s line width.

The stroke width expression furthermore uses the river category (GEW_GRKL) to vary the line width depending on the category:

WHEN "GEW_GRKL" = '< 10 km2 Fluss' THEN 0.2
WHEN "GEW_GRKL" = '10 km2 Fluss' THEN 0.4
WHEN "GEW_GRKL" = '100 km2 Fluss' THEN 0.6
WHEN "GEW_GRKL" = '1.000 km2 Fluss' THEN 0.8
ELSE 1.0
* ( 1- ( @geometry_part_num /  @geometry_part_count ))

If the rivers are digitized in downstream direction, you can simply remove the 1- term.

Happy mapping!

  1. Nice! I wonder if you could not accentuate the effect more by using the inter-vertex segments rather than the geometry parts? So that along a single course of the river is appears to narrow as it heads further up the catchment?

    • Thanks Tim! Doesn’t the geometry generator already return inter-vertex segments? Or do you mean that something in the expression should be changed?

  2. Jochen Huber said:

    The possibilities offered by the geometry generator are really amazing. Your examples are very helpful to get started using it. In this example it is important, however, that the main stream is always continuous from source to map border. Otherwise thickness suddenly jumps from thick to narrow along its course, as is the case in the southwest of the example (should be the confluence of Rosanna and Trisanna, from where the river is called Sanna).

    • Yes, that’s correct.

  3. Totò said:

    To do a test, in the shapefile there is no field on the flows (GEW_GRKL)

%d bloggers like this: