I have a slope raster in degrees and would like to reclassify it the layer with the raster calculator.

my criteria: slope between 15 & 20 receive a 1 slope greater than 20 receive a value of 2 all other values receive a zero

Con(("noury_slope" >= 15) & ("noury_slope" <= 20,1,0)),Con("noury_slope" > 20,2,0)

get this error

ERROR 000539: Error running expression: rcexec() 
Traceback (most recent call last):
  File "<expression>", line 1, in <module>
  File "<string>", line 5, in rcexec
  File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\sa\Functions.py", line 3806, in BooleanAnd
  File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\sa\Utils.py", line 53, in swapper
    result = wrapper(*args, **kwargs)
  File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\sa\Functions.py", line 3803, in Wrapper
    ["BooleanAnd", in_raster_or_constant1, in_raster_or_constant2])
TypeError: expected a raster or layer name

Failed to execute (RasterCalculator).
Failed at Mon Aug 21 10:42:24 2017 (Elapsed Time: 0.30 seconds)

I want to do this query in one step. whats wrong with my syntax


1 Answer 1


You need to separate your parameters.

Try this:

Con("noury_slope" > 20, 2, Con(("noury_slope" >= 15)  & ("noury_slope"<= 20), 1,0))

Your Answer

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

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