import arcpy import arcpy.sa as sa # input raster ras1 = r"D:\mal\Soil_Type.tif" # value of ras1 to be evaluated as true class1 = 3 # Define output layer ras_output = (r"D:\mal\soils.gdb\soiltype_overlap") ras3 = sa.Con(ras1 == class1, 1, 0) ras3.save(ras_output)
Is the tiff file an integer file?
To use the syntax that you have, declare ras1 as a raster (line 5 in your code):
ras1 = sa.Raster(r"d:\ma1\Soil_Type.tif")
then your Con statement should work. Otherwise, I think that Python evaluates ras1 == class1 as a string comparison.