Is it possible in QGIS either directly or via plugins to do a raster calculation including an if statement?

e.g., if raster1 > 0.3, then raster 1 * raster 2, else raster1 x raster3... something like that?

1 Answer 1


In QGIS Raster Calculator, the comparison return 0 (if false) or 1 (if true). So you can write a conditional using a sum of products.

((raster1@1 >0.3) * raster1@1 * raster2@1 ) + ((raster1@1 <=0.3) * raster1@1 * raster3@1 )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.