6

I would like to normalize a raster, using the raster calculator in QGIS 3.x but I don't know how to use the maximum and minimum operator. I have tried the following sequence but it does not recognize it:

("Vuln_Erosion @ 1"-minimum ("Vuln_Erosion @ 1")) / (maximum ("Vuln_Erosion @ 1") - minimum ("Vuln_Erosion @ 1"))

1 Answer 1

4

There is no direct way to calculate the minimum and maximum from the Raster Calculator in QGIS. The only workaround is to extract the minimum and maximum of the raster layer using Raster layer statistics tool from Processing Toolbox, and save it into a text editor:

enter image description here

Then use the above minimum and maximum values in the raster calculator from Processing Toolbox NOT from Raster toolbar main menu.

Here is an example:

This is the input raster:

enter image description here

Using Raster Calculator from Processing Toolbox:

enter image description here

The output will be like this:

enter image description here

As you can see the range is not set to minimum 0 to maximum 1 because the QGIS is not rendering statistics correctly. You need to re-render it from Layer Properties -> Symbology -> Statistics

enter image description here

Click Apply and it will be updated to 0 and 1 range:

enter image description here

2
  • Thanks @ahmadhanb, I'm trying to build a model in graphical modeler and one of the steps is to normalize one raster. I don't know how to do all process in graphical modeler Sep 11, 2019 at 10:42
  • @AlejandroChamizodeCastro I did not use Model Builder before, but I think what you need to use the Raster layer statistics tool and Raster Calculator and both of them exist in the Processing Toolbox, which can be added into the model builder.
    – ahmadhanb
    Sep 11, 2019 at 11:10

Your Answer

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

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