Tutorial: Calculate the Topographic Wetness Index from a DTM

Site: OpenCourseWare for GIS
Course: QGIS Advanced Tutorials
Book: Tutorial: Calculate the Topographic Wetness Index from a DTM
Printed by: Guest user
Date: Tuesday, 21 January 2025, 12:34 AM

1. Introduction

The Topographic Wetness Index (TWI) is a useful model to estimate where water will accumulate in an area with elevation differences. It is a function of slope and the upstream contributing area:

TWI =

Where:

a = uplope contributing area (m2)
b = slope in radians.

In this tutorial we're going to implement this equation in QGIS. The input data is a DTM.

After this tutorial you'll be able to:

  • Interpolate voids in a DTM
  • Calculate slope in degrees
  • Convert slope from degrees to radians
  • Calculate TWI



2. Interpolate Voids in the DTM

The provided DTM is derived from LIDAR data from the Netherlands (AHN3). The data in the Dutch Amersfoort projection (EPSG: 28992). The DTM, however, has voids. Voids are pixels with nodata. These voids need to be interpolated before we can continue.

1. Start QGIS.

2. Add the provided DTM (dtm.tif) to a blank project.

You can clearly see the voids.

voids

3. Go to the Processing Toolbox: in the main menu choose Processing | Toolbox.

4. In the Processing Toolbox select GDAL | Fill nodata.

5. In the Fill nodata dialogue choose dtm as Input layer. Keep other settings as default (you can play with these if the voids are bigger). Save the result as dtm_voidfilled.tif.

6. Click Run. Close the dialogue after processing.

7. Remove the dtm layer from the Layers panel.

In the result you can clearly see that the voids have been interpolated.

voids interpolated

8. Style the DTM with Singleband Pseudocolor. You can use a Topography ramp from the cpt-city catalogue. Blend the DTM with the hillshade (see other tutorials on how to do this).