1

I would like to combine two raster in Raster calculator of Saga.

With raster calculator of QGIS , I have no problem, but with ifelse command syntax of Saga, the operation don't run. The operation is :

(( "A" < 25) AND ( ( "B">0.05 ) AND ( "B"<0.1)))*1 + (( "A" >= 25) AND ( ( "B">0.05 ) AND ( "B"<0.1)))*2 + (( "A" < 15) AND ( ( "B" >= 0.1 ) AND ( "B"<0.3)))*1+ ((( "A" >= 15) AND ("A"<35)) AND ( ( "B" >= 0.1 ) AND ( "B"<0.3)))*2+ (( "A" >= 35) AND ( ( "B" >= 0.1 ) AND ( "B"<0.3)))*3+ (( "A" < 25) AND ( ( "B" >= 0.3 ) AND ( "B"<0.5)))*2+ (( "A" >= 25) AND ( ( "B" >= 0.3 ) AND ( "B"<0.5)))*3+ (( "A" <15) AND ( ( "B" >= 0.5 ) AND ( "B"<0.8)))*2+ ((( "A" >= 15) AND ("A"<35)) AND ( ( "B" >= 0.5 ) AND ( "B"<0.8)))*3+ (( "A" >= 35) AND ( ( "B" >= 0.5 ) AND ( "B"<0.8)))*4+ (( "A" <5) AND ( "B" >= 0.8 )) *2+ ((( "A" >= 5) AND ("A"<25)) AND ( "B" >= 0.8))*3+ (( "A" >= 25) AND ( "B" >= 0.8 )) *4

where A e B are rasters (DEM and SLOPE)

3

The ifelse operator is not necessary in your expression. For instance, consider its first addendum:

(( "A" < 25) AND ( ( "B">0.05 ) AND ( "B"<0.1)))*1

Using the SAGA Grid calculator syntax, it could be something like:

lt(a,25)*gt(b,0.05)*lt(b,0.1)*1

Instead, considering the second addendum:

+ (( "A" >= 25) AND ( ( "B">0.05 ) AND ( "B"<0.1)))*2

it could be rewritten as:

+(1-lt(a,25))*gt(b,0.05)*lt(b,0.1)*2

...and so on.

  • OK thanks. And the expression : ((( "A" >= 15) and ("A"<35)) and ( ( "B" >= 0.1 ) and ( "B"<0.3)))*2 ??? – Giuseppe Cillis Oct 2 '17 at 20:34
  • 1
    Don't mention it. It should be (1-lt(a,15))*lt(a,35)*(1-lt(b,0.1))*lt(b,0.3)*2. – Antonio Falciano Oct 3 '17 at 8:24

Your Answer

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

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