I am running a script that is working (see below) - it pulls a file from a folder, clips from that file based on an intersection with another file, and creates a new shapefile in a new folder. It has been working, except that it generates empty outputs for only some of the inputs.
With some research I've tried the following fixes to no avail:
- Check extent and projection of Clipping feature to match that of the Input features.
- Shorten output file name (hence the awkward string parsing in the output)
- Standard re-boot of computer, programs.
- [edit] Also convert Clipping file from Multi-Part to Single-Part Polygon.
Any ideas? Do you see quirks with my script? Are there quirks of Clip tool? Thanks!
#Script - Clip selected buffer circles from WEA areas.
#Input: VTRX_1_distX_sel.shp
#Clip: WEA file
#Send output to clip folder
import arcpy import sys import os from arcpy import env
#Set overwrite arcpy.env.overwriteOutput = True print arcpy.env.overwriteOutput
#Set workspace workspace = "C:\\BOEM\\circle_areas\\" arcpy.env.workspace = workspace sel_files = workspace+"selectedcirc\\"
fileList = [] count = 0
directorypath = "C:\\BOEM\\circle_areas\\selectedcirc\\"
for dirname, dirnames, filenames in os.walk(directorypath):
for filename in filenames:
if filename.endswith("1_sel.shp"):
# filename = "VTR10_1_dist1_sel.shp"
print "___"
print "Clipping from " + filename
print "___"
in_features = sel_files+filename
clip_features = "C:\\BOEM\\circle_areas\\WEA_proj_sing.shp"
out_features = workspace+"clip\\"+filename[0:5]+"_"+filename[11:13]+"c.shp"
print "Input file " + in_features
print "Output file " + out_features
#Clip
arcpy.Clip_analysis(in_features, clip_features, out_features,"")
print arcpy.GetMessages()
print "___"
print "___"
print "___"
##