AnsweredAssumed Answered

Batch_Extract_By _Maskes with one raster and multiple shapefiles

Question asked by bob_says48 on Feb 25, 2013
Latest reply on Feb 25, 2013 by bob_says48
Hi All, I am very noob to python scripting and today i figure i take a crack trying to write a script but for some reason my script does not work. Essentially, I'm trying to extract a DEM Raster file with many shapefiles but when I ran the following scripts, nothing happens at all in my python idle.

here's my script and if anyone can give me a hand I will be greatly appreciated!

# ---------------------
# Extracts raster file by numerous shapefiles
# defined by a mask.
# Author:
# Date: 02/25/2013
# -----------------------------

# Import system modules
import sys, string, os, arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

    # Check out any necessary licenses

    # Load required toolboxes...
    gp.AddToolbox("C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Spatial Analsyt Tools.tbx")

    gp.workspace = "D:\SH Personal Project\FSWTA\PKI\Individual_watersheds.gdb"
    out_workspace = "D:\SH Personal Project\FSWTA\PKI\Clipped_Ind_FSW_WatershedDEMS.gdb"
    DEM_Mosaic = "D:\SH Personal Project\FSWTA\PKI\Clipped_WatershedDEM.gdb\Clipped_FSW_WatershedDEM"

    # Get a list of the shapefiles in the workspace
    shapes = gp.ListFeatureClasses()

    # Loop through the list of shapefiles
    shape =

    while shape:
        # Set the outputname for each output to be the same as the input
        output = out_workspace + shape

        # Process: Extract by Mask...
        gp.ExtractByMask_sa(Watershed_DEMS, shape, output)

        # Loop
        shape =

    # If an error occurred while running a tool, then print the messages.
    print "Error in script"
    print gp.GetMessages()