For a suitability analysis I need to sum up three raster layers a,b,cconsidering different conditions. let's say, output layer is d.

I'd prefer Open Source Software, particularly QGIS (with SAGA, GRASS, R extension)

All three layers have the cell values: NoData; 1 (noGo); 2 (very bad); 3 (critical); 4 (good); 5 (mustGo).

I have the following conditions:

if a=1 OR b=1 or c=1 then d=1
if a=5 OR b=5 or c=5 then d=5
else d=(a+b+c)/("number of raster with value between 2 and 4")


a=2, b=4, c=1 --> d=1
a=5, b=4, c=2 --> d=5
a=5, b=4, c=3 --> d=(5+4+3)/(1+1+1)=4
a=4, b=4, c=NoData --> d= (4+4)/(1+1)=4

With SAGA GIS Raster Calculator, this formula worked:



Is there any way, for a better/cleaner formula? This one is so clumpy. I could also do 0 instead of NoData.


I've just realized, that the formula doesn't work properly. As you can see here: The NoDatavalue in raster a curtains the calculation to the lines (roads) which have values in raster a.Actually, I'd expect (3+2)/(1+1)=3.5here. (I took a cell somewhere in the black area)enter image description here

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.