I am very beginner and would like to customize ArcGIS using python scripting
for my thesis. I have to iterate Extract by Mask tool to extract several
raster layer using watershed boundary (vector) and tried to with the
attacthed code. But I am unable to get the result and got the following
error:


Running script multiExtract...

Error in script multiExtract.

Error in executing: cmd.exe /C C:\EROSIO~1\MULTIE~1.PY "'C:\HfT
Thesis_Bikash\thesis data\A2008257NDVI.tif';'C:\HfT Thesis_Bikash\thesis
data\A2008273NDVI.tif'" "C:\HfT Thesis_Bikash\thesis
data\exactbound_gcs.shp" "#"

Failed to execute (multiExtract_4).

End Time: Mon Jan 05 14:23:36 2009 (Elapsed Time: 1.00 seconds)
I will pleased to hear any sugestion. Thanks

-- 
Bikash Sherchan
In der Au 16C/3102
70327 Untertürkheim
Germany

Tel: +4971112164816   (Home Zone)
     +4917664081666 (Mobile Zone)
## Script Name: Multiple Extraction by Mask
## Description: Extracts multiple raster layers using mask (feature or raster)
## Created By: Bikash Sherchan
## Date: 

# Import Standard Library modules
import win32com.client, sys, os, os.path
import string, math, arcgisscripting

# Create the Geoprocessor object
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")

# Load required toolboxes...
# gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis 
Tools.tbx")
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst 
Tools.tbx")


# Set the input workspace
gp.workspace = sys.argv[1]

# Set the mask
mask = sys.argv[2]

# Set the output workspace
outWorkspace = sys.argv[3]

try:
    # Get a list of the rasters in the input workspace
    rsList = gp.ListRasters()           # all rasters in the input workspace
    
    # Loop through the list of rasters
    rsList.Reset()
    rs = rsList.Next()
    
    while rs:
                           
        # Extract each raster layer by Mask (feature or raster)
        tempEnvironment0 = gp.mask
        gp.mask = ""
        gp.ExtractByMask_sa(rs, mask, outWorkspace)
        gp.mask = tempEnvironment0           
        #rs = rsList.Next()
except:
    gp.AddMessage(gp.GetMessages())
    print gp.GetMessages()
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to