Automatically delineate a watershed in QGIS



A watershed is an area of land that captures water, which eventually flows through a single point or outlet such as rivers, reservoirs, and the ocean.

QGIS 3 has a set of hydrology tools to automatically delineate a river basin using GRASS tools, this entry shows the step-by-step procedure to execute this procedure (using QGIS version 3.10), previously it is recommended to download the DEM file for practice.


To run the GRASS tools it is recommended to have them activated in the QGIS 3 configuration, or alternatively to open (in Windows from the Start menu) the QGIS Desktop 3.10 with GRASS 7.8.0 application.

QGIS Desktop with GRASS
In Windows from the Start menu you can search for and open the application QGIS Desktop 3.10 with GRASS 7.8.0

In a new QGIS 3 project it is necessary to load the DEM, now go to the Processing Toolbox panel and run the hydrology tools in the following sequence:

  • r.fill.dir
  • r.watershed
  • r.water.outlet
  • r.to.vect
  • r.stream.extract

To remove imperfections and correct the DEM, the r.fill.dir tool is used. In the Elevation field, use the DEM of the basin to be delimited as the input raster layer.

Toolbox > GRASS > Raster (r.*) >

r.fill.fir Grass QGIS 3

The next process is to obtain the accumulation and direction rasters, to do this run the r.watershed tool.

Toolbox > GRASS > Raster (r.*) >

r.watershed Grass QGIS 3

In the r.watershed tool it is recommended to configure only the following fields:

  • Elevation.- Select from the corrected DEM (previously).
  • Minimun size of exterior watershed basin.- Selects the cell size of the DEM, you can see it in the layer properties information (in this case 3).
  • Enable Single Flow Direction (D8).- Check the box.
  • Number of cells that drain through each cell.- Select a directory and name for the accumulation raster.
  • Drainage direction.- Select a directory and name for the direction raster.

Now to delimit the basin look at the accumulation raster (which shows the “water network”) and determine the exit point (red point), then open the tool r.water.outlet.

Toolbox > GRASS > Raster (r.*) >

r.water.outlet Grass QGIS 3.10

In the Name of input raster map field, select the address raster, and in Coordinates of outlet point, select the coordinate of the outlet point of the micro-basin (you can add it directly with the marker that comes with the tool, in this example 704322.378310,9555967.672071 [EPSG:31977]).

If all goes well we should have a raster as shown in the image below.

Basin Grass QGIS 3

To obtain the polygon of the micro-basin it is only necessary to convert the raster to a polygon type vector (shapefile, geopackage, etc.), this can be done with the r.to.vect tool.

Toolbox > GRASS > Raster (r.*) >

Under Input raster layer select the raster of the delimited basin, check the box Smooth corners of area features to give a smoothing to the edges, and under Advanced parameters > v.out.ogr select area. In the last field give the option to save in polygon in different vector formats.

If it is required to obtain the water network either in vector or raster format use the r.stream.extract tool.

Toolbox > GRASS > Raster (r.*) >

r.stream.extract Grass QGIS 3

In the r.stream.extract tool it is recommended to configure only the following fields:

  • Input map: elevation map.- Select from the corrected DEM.
  • Minimun flow accumulation for streams.- Select a value to set the density of the water network, in this example 2500 is used, but it can be increased or decreased (this value depends on the size of the raster pixel, if you need to decrease the density you must increase the value or vice versa, this can also be done with a raster calculator).
  • Advanced parameters > v.out.ogr.- select line.
  • Unique streams ids (rast).- Select a directory and name for the raster of the water network.
  • Unique streams ids (vect).-Select a directory and name for the water network vector.

The result of the delimitation of the micro-basin is shown in the following image.

Delimitar una cuenca hidrográfica en QGIS 3
تعليقات
ليست هناك تعليقات
إرسال تعليق



    وضع القراءة :
    حجم الخط
    +
    16
    -
    تباعد السطور
    +
    2
    -