mask raster by many shapefile

Discussion created by abotaha79 on Jun 22, 2011
Latest reply on Apr 2, 2012 by sbarrow
Hi guys,
i am very new in python and i have problem with what i want to do.
i have many shapefiles (more than 35) and i have one image. i want to mask the image by these shapefiles. i have made a simple python code but it does not work!!.. i need some help to achieve that.

The code is

import sys, string, os, arcgisscripting, math , arcpy, arcgisscripting, string

from arcpy import env

from arcpy.sa import *

gp = arcgisscripting.create()

gp.OverWriteOutput = 1



gp.workspace = "D:/DdAaTtAa/Data/"

outshp = "D:/DdAaTtAa/Data/new/" # The output

fcstring = " "

fcs = gp.ListFeatureClasses()

Inraster = "D:/DdAaTtAa/Data/image/"

fc = fcs.next()
while fc:
    print fc
    fc = fcs.next()
fc = fcs.next()

print gp.GetMessages()

while fc:
    print fc
infc= fc
OutRaster = outshp + "/" + str(fc)
print gp.GetMessages()
gp.ExtractByMask_sa(Inraster, infc, OutRaster)
print gp.GetMessages()

Any help it would be highly appreciated.