Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

python code to create an intersection loop with a geodatabase

$
0
0

I am trying create a loop that will intersect each individual township with a statewide section layer. I am having trouble with the syntax of the intersect tool I think, but maybe it is something else. Any help is greatly appreciated.

# Import system modules
import sys, string, os, arcgisscripting
import arcpy, os, sys, string
from arcpy import env
from arcpy.sa import *
gp = arcgisscripting.create()

arcpy.OverWriteOutput = 1
arcpy.env.overwriteOutput = True


input_folder = "C:\state\towns.gdb"
arcpy.env.workspace = input_folder
out_wksp = "C:\state\township_sections.gdb\"

env.workspace = input_folder

fcl = arcpy.ListFeatureClasses()
print fcl

infeatures = ["C:\state\towns.gdb\sections", fcl]
print infeatures


#ExtractByMask_sa (in_raster, in_mask_data, out_raster) 
for fc in input_folder:
    print fc
    arcpy.Intersect_analysis(infeatures, out_wksp + fcl, "ALL", "", "INPUT")
    #arcpy.Intersect_analysis(["C:\state\towns.gdb\sections" fcl], out_wksp + fcl, "ALL", "", "INPUT")
#    fc = fclist.Next()
    print 'clipped', fcl

print 'done'

Viewing all articles
Browse latest Browse all 767

Trending Articles