Setting extents with masks
The extent of a layer can be set using a second layer, which acts as a mask. This recipe shows you how to do this.
How to do it…
To mask the DEM with the watershed mask, follow these steps:
- Open the
watershed.tif
layer and thedem.tif
layer. - Open the Raster Calculator algorithm present in the Processing Toolbox menu.
- In Main input layer, select the DEM, and in the Additional layers field, select the watershed layer.
- In the Formula field, enter the formula, a*b.
- Click on Run to run the algorithm. You will get a masked DEM, as follows:
How it works…
When using the raster calculator, all operations involving a no-data value will result ...
Get QGIS: Becoming a GIS Power User now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.