ArcGIS Raster Calculator – Building Multiple CON Statements with OR and AND

arcgis-desktopconraster-calculatorspatial-analyst

I have two raster "T" and "N" which have values ranging from 0 to 1000. This is the logic that I want to query and create the new raster:

query logic

This is how I tried to query in a syntax-correct way in the Raster Calculator in ArcGIS, but the resulting raster only shows the value "1", but no error.

Con(("T.tif" < 50) & ("N.tif" < 40), 100, 0) | 
Con(("T.tif" < 50) | ("N.tif" < 40), 80, 0) |    
Con(("T.tif" < 55) & ("N.tif" < 45), 60, 0) | 
Con(("T.tif" < 55) | ("N.tif" < 45), 40, 0) | 
Con(("T.tif" < 60) & ("N.tif" < 50), 20, 0)

What am I doing wrong?

Best Answer

I think you want to use nested Con statements, like is described here to build your if-elif-else structure, instead of Con() | Con() | Con(). Instead of saying:

Con(queryA, trueA, falseA) | Con(queryB, trueB, falseB) | etc...

You should phrase it as:

Con(queryA, trueA, Con(queryB, trueB, Con(...)))

where the innermost Con() statement will have 0 as it's false value.

Related Question