2

I'm confused about the results that I get from the raster calculator in QGIS.

I'm trying to delete the cells of a raster who are prone to flooding. However, a part of my raster is wrongly classified as a high risk area, thus for this part I want to use the original raster and for the other areas I want to delete the cells with a high flood risk.

Below, I added my rasterized polygone layer, red is the part that I want to keep from the original layer and has a value of -2, the rest is -1. This layer is my original layer:

enter image description here

and this is the raster adapted for flood risk:

enter image description here

White areas are areas without data.

In the calculator I typed:

("rasterized" = -2) * "original layer" + ("rasterized" = -1) * "adapted layer"

However, it returns the adapted layer only. Also when I switch the values, I get the adapted layer.

When I make two seperate layers: one with the part of the original layer that I want and one with the part of the adapted layer, this formulas seems to work, but again when I add them I only get the adapted layer.

Does anyone has an idea of what I might be doing wrong?

Your Answer

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

Browse other questions tagged or ask your own question.