# SAGA raster calculator, ifelse command syntax problem

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)

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
``````

``````+ (( "A" >= 25) AND ( ( "B">0.05 ) AND ( "B"<0.1)))*2
``````+(1-lt(a,25))*gt(b,0.05)*lt(b,0.1)*2
• 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