3

I am using QGIS 3.10 and try to solve the following task. I have a multiband raster (4 bands in total), where each band represents the spatial extent of a tropical storm and the respective pixel value represents the wind speed.

In other words, the multiband raster contains all tropical storms within a given area for a respective year. In this case there have been 4 tropical storms, represented by the 4 bands. Now I want to create a singleband raster containing the max value of the 4 rasters, so that the new singleband raster image contains the maximum wind speed exposure for cell i in year t. If a cell was hit by two storms, I want to assign the value of the band with the higher wind speed.

The question in short is: How do I tell QGIS to compare the raster values of all bands and then choose the highest one. I tried the raster calculator, but I could not figure out a suitable option and I am not really familiar with the syntax in the raster calcaaltor.

0

1 Answer 1

2

you can use the rastercalculator for that with an expression like this one:

("raster@1" >= "raster@2" AND "raster@1" >= "raster@3" AND "raster@1" >= "raster@4") * "raster@1" +
("raster@2" > "raster@1" AND "raster@2" > "raster@3" AND "raster@2" > "raster@4") * "raster@2" +
("raster@3" > "raster@1" AND "raster@3" > "raster@2" AND "raster@3" > "raster@4") * "raster@3" +
("raster@4" > "raster@1" AND "raster@4" > "raster@2" AND "raster@4" > "raster@3") * "raster@4"

where raster is your rasterlayer

1
  • Awesome, thank you so much for the help. Apr 15, 2021 at 18:52

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.