I am trying to run a script which for each row in an attribute able of catchment-shapefile select points from postal shapefile that fall inside the area of the selected catchment row feature.
Here is my script. I am having an issue where it does not select features correctly I end up with an exact copy of the original postal shapefile. I cannot see why this is happening.
import os, arcpy arcpy.env.overwriteOutput = True postal = r"U:\fwd_sept16\postal2_fz2.shp" catchment = r"H:\Documents\robgis\fwd Data\properties_catchment.shp" infield = "catch" outname = r"U:\fwd_sept16" arcpy.MakeFeatureLayer_management(postal,"temp") with arcpy.da.SearchCursor(catchment, "catch") as cursor: for row in cursor: #SELECT PROPERTIES BY CATCHMENT arcpy.SelectLayerByLocation_management("temp","INTERSECT",catchment,"","NEW_SELECTION") #OUTFIELD NAMEING outFeature = outname + "\\" + row #COPY SELECTED FEATURES arcpy.CopyFeatures_management("temp", outFeature) print row