Franz's blog

Catchment delineation with QGIS

Very often catchment delineations are required for several processes in hydrological analysis. The GIS offers a lot of flexible tools in order to derive these products, using as main input a Digital Elevation Model (DEM) of a study area. Several tools are available to achieve this purpose, even tools not directly related to GIS like Matlab or Python scripts, but definitely GIS applications are the most widely used in these kind of tasks.

In this very short and basic tutorial I will show you how to delineate a catchment using as main income a DEM from ASTER and a point feature, also indirectly other products like the accumulation flow raster and the drainage direction raster will be derived, yet these are not the main points of this exercise.

We will start with a DEM for a region in Europe downloaded directly from the ASTER-DEM website it must be pointed, that prior to the utilization of this information, it must be reprojected into UTM coordinates, since the ASTER products are delivered using a geographic coordinates. In this case I am using the reprojected information into UTM ellipsoid WGS84, zone 31 North.

We can summarize the steps for catchment delineation as follows:

  • Preprocess information: merge, reproject, subset the information. (NOT IN THIS EXERCISE)
  • Fill the voids or gaps in the DEM: r.fill.dir
  • Derive the flow direction and flow accumulation rasters: r.watershed
  • Define the outlet and delineate watershed: r.water.outlet
  • Final steps: vectorize, smooth: r.to.vect
    *in bold the names of the QGIS tools are indicated.

These steps are a generic scheme, which I had used it does not necessarily mean that it is correct a-priori, and It will depend in a number of external factors. Yet, I will follow the described logic since I have experience following that order.

Filling the voids

With a naked eye, the following DEM does not seem to have holes/gaps were information could be missing or be erroneous:

Add DEM in QGIS

Yet, sometimes due to a number of factors, DEM includes artifacts and errors which can give us troubles when delineating the catchments. For this reason, it is necessary, first to ‘fill’ the DEM in order to avoid later errors.

The objective of this step is to turn the DEM into a ‘hydrologically correct’ DEM which means that the sinks which can alter the water flow in our study area have been filled and hence the streams and other products will be correct or at least will behave logically according to hydrological rules, like water always flowing downstream and not disappearing into false sinks.

The correction is done in QGIS using the GRASS tool r.fill.dir which filters and generates a depressionless elevation raster with a given input DEM (GRASS GIS, 2016).

Filter and generated a depressionless elevation layer

The only required input is the DEM to be processed (Elevation) and the outputs are: the corrected DEM (Depressionless DEM) the flow direction raster (Flow direction) and the identified areas with problems (Problem areas), as we need only the corrected DEM, the other outputs can be unselected and the algorithm run. [The algorithm parameters are indicated in parentheses and if a parameter is not mentioned it should be left as it comes by default].

After running the algorithm, a new layer is created with the filled DEM which we will use in the following steps.

Deriving the flow direction and flow accumulation rasters

With the filled DEM, we can now derive the flow direction and accumulation rasters using the GRASS GIS tool r.watershed tool. This tool allows the calculation of several parameters which in turn can be used to perform several other analyses, in our case we will use it only to derive the flow accumulation and direction rasters.

Watershed basin analysis program

As you can realize, this tool presents a lot of inputs and outputs, but we will focus only in a couple of them. As input (Elevation), we will use we will use the corrected DEM, then we will skip the parameters until the ‘Minimum size of exterior watershed basin’ which in order to run the tool it requires to be filled.

This parameter determines the minimum size of a catchment in order to be identified by the algorithm, in other words it defines the minimum size of an individual basin to be considered as an individual entity, if it is too small, the basin will be merged with the contiguous basins, until the minimum size if completed. This parameter can be tricky to define and it depends on several factors like the desired minimum size of our catchment, the DEM’s pixel size and so on. But in this case, since we do not want to derive the basins using this tool, we need to find a value in order to run the tool. You can try with values, for example 1000 and the run the tool, if it crashes try with another number. Obviously this tool is very useful, and deeper analysis is required, but in this case since we need the rasters we will omit the details. In any case a lot information is available for the tool if further details are required.

  Download images from Google Earth

Then, the rest of parameters are left blank/default and we move to the outputs. Untick all the outputs but the rasters: ‘Number of cells that drain through each cell’ which defines the flow accumulation raster and the ‘Drainage direction’ which defines the flow direction raster. Define a correct name and path and execute the tool.

Depending on the size of your study area and pixel size, the execution of the tool will take more or less time, take that into account when using extensive DEMs.

The final product should be 2 rasters: the flow accumulation and flow direction, which after the execution of the tool will be automatically loaded into the map view.

NOTE: for some reason, the flow direction generated with the r.fill.dir tool cannot be used in the following steps, for that reason the drainage direction raster must be generated using instead the r.watershed tool as described in the previous section.

Define the outlet

So far we have corrected the DEM, and derived the drainage direction raster which are the inputs we need for this step.

The drainage direction should look like this:

Drainage direction

While the ‘Number of cells that drain through each cell’ or flow accumulation raster will look initially totally black:

Flow accumulation

But after modifying the visualization properties, readjusting the real minimum and maximum values to be displayed, the appearance will change to:

Flow accumulation minimum and maximum values

As you can notice, in the flow accumulation raster, some patterns are now noticeable, in summary this raster represents the number of cells or pixels which, because of their location, drain towards each pixel. In this way seems logical to think that the pixels located in the lower parts (valley bottoms) will show the highest values of pixels flowing into them if compared with the pixels of the upper parts where the accumulation values will be low. You can check this inquiring some values across the recently defined raster.

Being not part of this tutorial a deep explanation about the particular meaning and interpretation of these rasters I will stop here, and continue to the next steps. Just keep in mind that you need both the Drainage direction and flow accumulation rasters in order to continue to the next step.

Normally, when delineating catchments, the closing points are known, for example you have a sampling point, discharge point, or a hydrological station and the you want to define the area draining to that point.

In order to obtain the delineation of a catchment draining towards a particular point, the tool r.water.outlet from GRASS GIS is used. To use this tool, you require the drainage direction raster and the coordinates of the closing point:

Watershed basin creation program

NOTE: The coordinates must be expressed in the same units as the map.
The use of this tool is very straightforward and once the Drainage raster and the coordinates are indicated, the tool can be directly run. As result, the tool produces a raster containing all the pixels draining towards the indicated pixel (coordinates).

Watershed in QGIS

In the previous figure, the result is shown for a specified coordinate within my study area, the delineated catchment appears in blue.

Final steps

With the catchment delineated, as you can realize, it is a raster layer. Usually before using it, it is required to vectorize it (in order to calculate the area/perimeter for example), which can be easily done using the r.to.vect tool from GRASS GIS. The final results should look as follows.

Delineated catchment in QGIS

In green you can see the delineated catchment.

Conclusion and tips

  • With the described steps the delineation of a catchment using a DEM and coordinate can be relatively easy, using the GRASS GIS tools included in the QGIS standard pack.
  • The mentioned procedure is a very basic approach, since several processes were not in deep described (for example the r.watershed tool products) since the objective of this exercise is to show the program capabilities and not to in detail describe the processes behind the algorithms.
  • Very often the r.water.outlet tool might present errors when running it. It is mostly because wrong outlet points, in this case you should shift the points until the lower point is reached and then the algorithm can correctly delineate it. To do this, the accumulation raster can be used.
  • The obtained results will necessarily have to be verified, using for that other sources of cartography since it is based in a model and sometimes due to errors in the DEM the delineation process might deliver wrong results or artifacts.
  • With the flow accumulation raster, the stream network can also be derived but this is topic for another tutorial.
  • If you have several points to delineate, once you derived the drainage direction raster, you can apply the r.water.outlet tool in batch mode, which can allow you to do several runs in one single step, saving some precious time.

Coming next: Stream network delineation and the batch mode in QGIS.

Written by: Marlon Calispa

3 thoughts on “Catchment delineation with QGIS”

  1. Chris M says:

    Nice write up. I have previously managed to figure this much out and it is very useful for delineating general drainage areas. The limits that I have discovered are that this does not account for smaller drainage swales that may not be picked up in the DEM, culverts or subsurface drainage networks. It would be great if there was a way to edit the model to include these.

    1. Marlon says:

      That’s true, these tools work quite well in big areas but in smaller areas they often present problems. I have tried with better DEMs (smaller resolution) when available but it is more time consuming and frequently at that level of detail it is required to check with auxiliary material (photography or similar).

  2. Christene says:

    I’ve learned this procedure before in ArcGIS, this is a very useful post to use as a refresher/to find my way around QGIS. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *