In this case we developed a case study using tools available in QGIS 3.
It will show how to alter a Digital Elevation Model (DEM) using the Raster calculator, specifically how to incorporate a dam.
It is not intended to replace more suitable hydrological programs, but to develop an approach using QGIS 3.
Area of study:
It corresponds to a livestock production unit (farm) where cattle and poultry are raised.
The farm is located in a piedmont zone in the south towards high hills to the north, i.e. a tendency from flat zones in the south to steep zones in the north.
Layers and variables:
The site where the dam will be located is provided.
In the image the cyan diamond represents the location of the dike.
2.- Generate profiles to decide the direction and length of the dike using the Profile Tool complement (See the article Create a river profile in QGIS).
The aim is to achieve the largest dam with a dike of less length and height.
Under Output Extension: select the Raster layer of the MDE.
This generates a binary Raster of Rasterized name with value 1 corresponding to the dike and 0 the rest.
Incorporating the dike into the MDE:
4. Activate the Raster calculator and write some conditional assignment equations (see the article reclassifying a QGIS 3 raster).
( “Rasterized@1” > 0 ) * 280 + ( “Rasterized@1” = 0 ) * “MDE@1”.
This creates a new Raster that we name MDE-Dique1
- ( “Rasterized@1” > 0 ) * 280 selects the pixels of the dike (with value 1) then assigns them the value 280 which is the maximum height of the dike.
- + ( “Rasterized@1” = 0 ) * “MDE@1” the sign + concatenates another conditional. Then it selects the pixels with a value equal to 0 and assigns them the elevation value of the MDE.
5.- Subsequently, generate the profiles and verify the incorporation of the dam in the MOU.
6.- In the plant and 3D view you can see the shape of the dike.
Fine-tuning the result
The applied equation presents the disadvantage that assigns the elevation value 280 to the entire path of the dike, both in areas with elevations lower than 280 and higher than 280.
7.- The procedure can be fine-tuned by increasing the conditional and with the output name MDE-dike2:
(( “Rasterized@1” > 0 ) AND ( “MDE@1” <= 280 )) * 280 + (( “Rasterized@1” > 0 ) AND ( “MDE@1” > 280 ))* “MDE@1” + ( “Rasterized@1” = 0 ) * “MDE@1”.
- (( “Rasterized@1” > 0 ) AND ( “MDE@1” <= 280 )) * 280 selects the pixels of the dike and assigns the elevation of 280 only those in which the DEM elevation is less than 280.
- (( “Rasterized@1” > 0 ) AND ( “MDE@1” > 280 ))* “MDE@1” the pixels of the dike in which the MDE has elevations greater than 280, assigns it the elevation of the MDE.
- ( “Rasterized@1” = 0 ) * “MDE@1” the different pixels to the dike assigns the elevation of the MDE.
Finally, in the image the result:
In the next article we will determine and represent the dammed water mirror, as well as the dammed volume.