I am new to Python and am having difficulties trying to loop multiple rasters into a conditional statement. I want to extract all land-uses that have the value 21 from a folder with three different land-use layers.
When I run my code, I get an output that shows the land-use that equals value 21 for the first raster file in my folder, but it does not calculate an output for my other two raster files in my folder. My code is:
import arcpy from arcpy.sa import * arpy.CheckOutExtension('Spatial') arcpy.env.workspace=r'U:data\landuses' arcpy.env.scratchWorkspace='U\data\work.gdb' rasters=arcpy.ListRasters("*") for raster in rasters: ... ras=Raster(raster) ... outraster=Con(ras==21,21) ... outraster.save('U:\data\work.gdb' + raster)
When I run this, I get:
ERROR 010093: Output raster format UNKNOWN is unsupported.
My raster files are all "GRID" format.