8

I am looking to create a Maximum-Value Composite raster in QGIS

I have three raster images: Oct 2012 Nov 2012 Dec 2012 All are in TIFF Format, Float32, EPSG:4326 - WGS 84

I want to stack these images, then on a pixel-by-pixel basis,examine each value, and retain only the highest value for that pixel location to create a Maximum-Value Composite (refer to http://en.wikipedia.org/wiki/Maximum-value_composite_procedure)

e.g.(these are made-up numbers for illustrative purposes):

Pixel in Row 205 and Column 106 will have three values: 90 75 100

I want to choose 100, then move to the next pixel and do the same. In the end I should have a final raster with maximum values only, a maximum value composite!

I am have QGIS 1.8.0 & 2.0.1, GRASS 6.4.3RC2 and SAGA 2.0.8 at my disposal.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Feb 14, 2014 at 14:12
1
  • agreed, there should really be simple aggregate functions like MAX, MIN. Commented Dec 7, 2018 at 12:32

2 Answers 2

5

I think you can use QGIS raster calculator for this (Raster> Raster calculator...).

Having a rasterA, rasterB and rasterC layers, and assuming that you only have a band in each on of them, you can use a expression like this:

("rasterA@1" >= "rasterB@1" AND "rasterA@1" >= "rasterC@1") * "rasterA@1" +
("rasterB@1" > "rasterA@1" AND "rasterB@1" >= "rasterC@1") * "rasterB@1" +
("rasterC@1" > "rasterA@1" AND "rasterC@1" > "rasterB@1") * "rasterC@1"

The ("rasterA@1">= "rasterB@1" AND "rasterB@1">= "rasterC@1") parts, test id a certain layer value is bigger than the others will result in 0 or 1, whether the condition is satisfied or not. After the multiplication the result will have 0 or the value of the raster. Adding all the tree results will give you the hightest value.

There is probably a more elegant way to to this, but I think it will work.

answered Feb 14, 2014 at 14:50
0
0

From QGIS Raster Calculater Syntax, courtesy of @underdark:

(a>b AND a>c) * a + (b>a AND b>c) * b + (c>a AND c>b) * c

This answer worked for me in QGIS 2.0.1, I think the gt() method that was also referenced may only work for version 1.8, I didn't see that the RasterCalc plugin was available in 2.0.1.

answered Feb 14, 2014 at 14:51
1
  • I think this you are missing the a=b or a=c or b=c cases. And in any of those cases the result will be 0 instead of the maximum value. Imagine the following case a=2, b=2, c=1. Commented Feb 14, 2014 at 15:20

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.