What I have is a buffer which is then used to select a number of point features which intersect the polygon. I would like to take that number and add the value to a table. The row where the value will need to be located corresponds with the name of the original feature class the buffer was created from.
import arcpy from arcpy import env import os from os.path import join arcpy.env.workspace = r'MyWorkspace' updateTable = r'table' shortField = "FieldName" arcpy.MakeFeatureLayer_management("FieldName", "fieldname_layer") fcs = arcpy.arcpy.ListFeatureClasses("*_Value", "POLYGON") for fc in fcs: select = arcpy.SelectLayerByLocation_management("fieldname_layer", "INTERSECT", short) result = int(arcpy.GetCount_management(select).getOutput(0)) print short.replace('Buffer_','') + " " + str(result)
So far the best I can come up with is printing the file name less the Buffer_ portion which precedes the name I need. I cannot wrap my head around how to go from there to updating only relevant records using the update cursor.