7 votes

Set raster values to a specific number

Use Raster Calculator with an if-condition, available since QGIS 3.22, with this expression: if ("raster@1" >= 5 , 5, "raster@1")
  • 54.7k
6 votes
Accepted

Generating new raster by combining the values of two separate ones in Python

You can use this script. import rasterio import numpy as np # CHANGE paths file1 = r"c:\path\to\raster1.tif" file2 = r"c:\path\to\raster2.tif" output = r"c:\path\to\outout....
5 votes
Accepted

Set raster values to a specific number

One tool you can use in QGIS is Reclassify by Table. Your table should look like this:
  • 611
4 votes

NoData masks in QGIS

Run Raster Calculator with an expression like raster@1 >= 0 or raster@1 <=0 - this will produce on output with all not empty pixels set to 1 Run Menu Processing > Toolbox > Fill NoData ...
  • 54.7k
4 votes
Accepted

NoData masks in QGIS

First, you need to know what value is assigned to the nodata tag. You can see it in the Information tab of the layer properties: The pixels currently have that value (-1.25 in my case). I assume in ...
3 votes

Inverting values of raster file using QGIS

Invert values with QGIS Raster Calculator: -1 * "yourRaster@1" + MAX("yourRaster@1") but MAX() is not working properly according to some QGIS Bugs Reports. Instead of MAX() put ...
2 votes
Accepted

Sum two rasters to combine a building height raster and DTM

I supposed that the buildings raster has a lot of NULL value. You first need to convert null value to 0. Then in raster calculator: IF(buildings@1>0, buildings@1+DTM@1, DTM@1) Be careful, if you ...
  • 1,284
2 votes

Sum two rasters to combine a building height raster and DTM

Without seeing your data nor your outputs I would suspect that the elevation values in your build heights raster have no data values between the building footprints. Unless otherwise declared, a ...
  • 8,412
1 vote
Accepted

Use a conditional raster calculator formula with exponential from ArcGIS in QGIS

The following works: (("P@1" - "ETP@1" < 0)*"RUx@1" *("P@1" - "ETP@1") / "RUx@1" ^2.71828)+( "RUx@1"+"P@1"-"ETP@...
  • 423

Only top scored, non community-wiki answers of a minimum length are eligible