QGIS raster calculator is confusing me and I have no idea how to perform a very simple task.

I have 2 rasters, A and B:

Raster A has 9999 values on all pixels. Raster B has different values including no data pixels.

I want Raster A pixel to = Raster B pixel where B != null

Which means Raster C(output) is 9999 Except where Raster B has values


The QGIS-documentation provides a very similar example-task: https://docs.qgis.org/3.4/en/docs/user_manual/working_with_raster/raster_calculator.html

According to the documentation, the following should work:

("slope_clipped@1" > 0) * "slope_clipped@1" + ("slope_clipped@1" = 0) * 9999

Naturally, if you didn't describe your data correctly to us, this wont work.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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