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.
Case study:
Productive activities require a continuous supply of water; the location of a small dam is evaluated taking advantage of the steep relief.
Layers and variables:
The layers and the procedure will be used to generate the digital terrain model explained in the article “How to generate a QGIS 3 Digital Elevation Model“.
The site where the dam will be located is provided.
Procedure
1.- Generate the DEM with a pixel size of 2.5 wide and 2.5 high, load the Ubi_dique points layer.
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.
In the selected position the maximum length will be 120 meters on the crest, the maximum elevation will be 280 m.s.n.m.*.
Next, I created a polygon Shapefile and drew the shape of the polygon, define it as the name DIQUE.
3.- Then it will convert the dike to Raster format, for it Raster menu > Conversion > Rasterizar (vectorial to raster)
In the Input layer tab, enter the dike polygon layer (DIQUE), in A fixed value to Burn place 1, in horizontal and vertical resolution place 2.5 (the resolution of the MDE).
Under Output Extension: select the Raster layer of the MDE.
From the name and location of the output file, then click run….
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
Explanation:
- ( “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”.
Explanation:
- (( “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.