Tutorial: Stream and Catchment Delineation using GRASS tools

Site: OpenCourseWare for GIS
Course: QGIS Advanced Tutorials
Book: Tutorial: Stream and Catchment Delineation using GRASS tools
Printed by: Guest user
Date: Thursday, 21 November 2024, 4:58 PM

1. Introduction

The QGIS Processing Toolbox gives access to many useful GRASS algorithms.

In this tutorial we're going to use the GRASS tools to delineate the Rur river and its catchment.

After this tutorial you're able to:

  • create a hydrologically correct DEM by filling the sinks
  • calculate flow accumulation
  • delineate streams using a flow accumulation threshold
  • delineate a catchment of a specified outlet
The tutorial data is an SRTM 1-Arc Second DEM that has been clipped and reprojected to UTM Zone 32N/WGS-84.

2. Fill sinks in the DEM

The first step is to fill the sinks in the DEM. Sinks are artificial depressions that trap the water and prevent flow to the outlet.

1. Start QGIS Desktop with GRASS.

2. Add dem.tif to the Layers panel.

3. Open the Processing Toolbox panel: in the main menu go to Processing | Toolbox.

4. In the Processing Toolbox choose to GRASS | Raster (r.*) | r.fill.dir.

5. In the r.fill.dir dialogue choose the DEM layer as Elevation. Keep the default Output aspect direction format as grass. Save the Depressionless DEM as DEM_filled.tif (make sure to choose a GeoTiff) and uncheck the other output layers, because we don't need them.

6. Click Run. Close the dialogue after processing. Processing will take a while. Ignore the red warnings in the log.

More info about the algorithm can be found here.

7. Remove the DEM layer from the Layers panel so we only have the DEM_filled layer there to proceed with.

filled DEM


3. Calculate flow accumulation and flow direction

The next step is to calculate the accumulation of water over the filled DEM.

1. In the Processing Toolbox choose GRASS | Raster (r.*) | r.watershed.

The r.watershed tool has a lot of settings. Check the GRASS manual page for this tool to learn more about the settings of the algorithms.

2. In the r.watershed dialogue choose DEM_filled as Elevation. Set the Minimum size of exterior watershed basin to 500 pixels and check the box to Enable Single Flow Direction (D8) flow. Save the Number of cells that drain through each cell to accumulation.tif and save the Drainage direction to flowdir.tif. Uncheck the other outputs, we don't need them.

r.watershed dialogue

3. Click Run. Close the dialogue after processing. Ignore the warnings in red.

The flow direction layer is encoded using the GRASS definition: Drainage is 8 directions numbered counter-clockwise starting from 1 in north-east direction. The value 0 indicates that the cell is a depression area. Negative values indicate that surface runoff is leaving the boundaries of the current geographic region. The absolute value of these negative cells indicates the direction of flow. Therefore we need to convert the flowdir layer to absolute values.

4. In the main menu go to Raster | Raster Calculator.

5. In the Raster Calculator compose the following equation:

( "flowdir@1" < 0 ) * -1 * "flowdir@1" + ( "flowdir@1" >= 0 ) * "flowdir@1"

This equation is a condition which reads as: if the flow direction values are less than zero then the result is boolean True (1), else boolean False (0). Multiply this with -1 and the flow direction . In this way the first part of the equation results in the absolute values of the negative flow directions. Then we add the condition if the cells are larger than or equal to zero, give boolean True (1), else boolean False (0) and multiply this with the flow direction values. This means that non-negative flow direction values will keep their original value.

6. Save the result as flowdirabs.tif and click OK.

Normally we would style the flow direction result with a directional grid, but that's not part of this tutorial.

7. Remove the original flowdir layer from the Layers panel.
Flow direction GRASS absolute

The next step is to determine at which flow accumulation we can consider pixels as part of a channel.

4. Determine the flow accumulation threshold for channels

Now each pixel in the study area has a value for flow accumulation, i.e. the amount of upstream cells that drain through each cell.
Not all cells, however, are part of a river channel. We need to determine the threshold of flow accumulation above which we can consider the pixel as part of a river channel.

1. Install the QuickMapServices plugin: in the main menu go to Plugins | Manage and install plugins...

2. Install the QuickMapServices plugin.

3. In the main menu go to Web | QuickMapServices | OSM | OSM Standard.

4. Look for the Rur river on OSM Standard and inspect the accumulation layer with the Identify features tool from downstream to upstream.

You'll see that downstream the values go up to 2622554 while upstream they are much lower.
By comparing OSM Standard with the accumulation layer you need to determine the minimum flow accumulation for a river. Here we'll take 50000 cells as the threshold.

5. In the main menu go to Raster | Raster Calculator...

6. Type the following equation:

"accumulation@1" > 50000

Which means: if flow accumulation is larger than 50000 cells, then give boolean True (1), else give boolean False (0).

7. Save the result as channels.tif. Click OK.

8. Style the channels layer using the Paletted/Unique values renderer with blue for value 1 and remove value 0 to make it transparent.

Flow accumulation threshold calibration

Normally, you would repeat this for different threshold values until you get the best match with the rivers on a reference map or satellite image.

Here we'll continue with the value of 50000 cells.


5. Delineate the streams

In the previous section we've determined the flow accumulation threshold for determining the streams. Here we're going to delineate the streams using that threshold value.

1. In the Processing Toolbox choose GRASS | Raster (r.*) | r.stream.extract.

2. In the r.stream.extract dialogue choose DEM_filled as Input map: elevation map and accumulation as Input map: accumulation map. Change Minimum flow accumulation for streams to 50000 cells (that's the value that we've determined in the previous sections). Save the Unique stream ids (vect) to streams.gpkg. We don't need the other outputs.

3. Under Advanced parameters change the v.out.ogr output type to line.

4. Click Run. Close the dialogue after processing. Ignore the red warnings in the log.

Note 1: this only works with the GeoPackage output format for the line vector. A shapefile will result in an empty layer.
Note 2: the Input map: accumulation map is optional. If you don't provide this it will calculate the flow accumulation again, but the result will be slightly different then what we've calculated in the previous section.
For more info about r.stream.extract check the manual.

5. Style the streams vector layer.

Delineated streams

Now we have delineated the streams we can determine the outlet point on the stream for which we want to delineate the catchment.


6. Delineate the catchment

The next step is to look for the outlet of the catchment at the delineated stream and then calculate the catchment of this outlet.

1. Follow the delineated stream downstream to find the approximate location where the Rur (Roer in Dutch) enters the Meuse (Maas in Dutch) river. Use the OSM Standard and streams vector layer to find this location.

outlet

2. In the Processing Toolbox go to GRASS | Raster (r.*) | r.water.outlet.

3. In the r.water.outlet dialogue choose flowdirabs as Name of input raster map. For the Coordinates of outlet point click and choose the point on the delineated stream. Zoom in close enough.

4. Save the Basin as catchment.tif.

5. Click Run. Close the dialogue after processing.

6. Click right on the catchment layer in the Layers panel and choose Zoom to layer.

Catchment raster

Now we need to convert the catchment to a polygon.

7. In the Processing Toolbox choose GRASS | Raster (r.*) | r.to.vect.

8. In the r.to.vect dialogue choose catchment as Input raster layer and choose area as Feature type. Keep the rest as default. Save the Vectorized output as Rur_catchment.shp.

9. Click Run. Close the dialogue after processing.

10. Style the layers.

Stream and catchment delineated