How to process with a list of files using [arcpy.ListFeatureClasses] with script below? Any help from you all very appreciate!
try:
fcList = arcpy.ListFeatureClasses("P*","POLYGON")
fcList.sort()
print fcList
fcCount = len(fcList)
print fcCount
for fcs in fcList:
print "Selecting areas < 1ha from file: " + fcs
eliminate_file = fcs + "_elim"
arcpy.SelectLayerByAttribute_management(fcs,"NEW_SELECTION", expres)
arcpy.Eliminate_management(fcs, eliminate_file, "AREA", "", "" )
except:
print "Could not create feature layers"
******
This is from:
# Name: Eliminate_Example2.py
# Description: Eliminate features based on a selection.
# Import system modules
import arcpy
# Set environment settings
arcpy.env.workspace = "C:/data/Portland.gdb/Census"
# Set local variables
inFeatures = "blockgrp"
tempLayer = "blocklayer"
expression = '"Area_Sq_Miles" < 0.15'
outFeatureClass = "C:/output/output.gdb/eliminate_output"
exclusionExpression = '"OBJECTID" = 9'
# Execute MakeFeatureLayer
arcpy.MakeFeatureLayer_management(inFeatures, tempLayer)
# Execute SelectLayerByAttribute to define features to be eliminated
arcpy.SelectLayerByAttribute_management(tempLayer, "NEW_SELECTION", expression)
# Execute Eliminate
arcpy.Eliminate_management(tempLayer, outFeatureClass, "LENGTH",
exclusionExpression)
Message was edited by: Dan Patterson I moved this to geoprocessing and used syntax highlighting >> to format the code