AnsweredAssumed Answered

Zonal Statistics for multiple value rasters

Question asked by ljs5219 on May 14, 2013
Latest reply on May 14, 2013 by lpinner
Hi.
I wanna zonal tools.

I can use, simple arcpy modules.
I can use zonal statistics. but, i have many input raster.
so, i want to use arcpy of zonal tools, for many input raster at the one time.


# Import arcpy module import arcpy, os from arcpy import env from arcpy.sa import *  # Check out any necessary licenses arcpy.CheckOutExtension("spatial")  # Input data source arcpy.env.workspace = "C:/py/07" arcpy.env.scratchWorkspace = "C:/py/07" arcpy.env.overwriteOutput = True  ZoneData = "C:/py/FISHNET_4k_FeatureToPolygon.shp"  # Output File OutputFolder = "C:/py/zonal"  # Loop through a list of files in the workspace RasterFiles = arcpy.ListRasters() print RasterFiles print " "  # Local variables: for filename in RasterFiles:     print "Processing: {0}".format(filename)     input_dir = arcpy.env.workspace     inRaster1 = "C:/py/07/lai_0907_m"      outRaster1 = os.path.join(OutputFolder,"z4_" + filename)       # Process: Zonal Statistics     saveRaster = arcpy.sa.ZonalStatistics(ZoneData, "ID", inRaster1, "MEAN", "DATA")     saveRaster.save(outRaster1)  print "done"


but, it is only process one raster.

I have, 01~12.raster.

plz, help me.

Outcomes