AnsweredAssumed Answered

Select Current Feature in a Search Cursor Loop

Question asked by clintoncooper on Apr 30, 2015
Latest reply on Apr 30, 2015 by clintoncooper

I am looping through a shapefile using a Search Cursor loop, and need to create a specific operation.  I need to select the current feature that the loop is on, and then run a select by location operation on that selected feature.  Once my operation is done, I then need to move onto the next feature in the loop.  Here is my current code:

 

[code]

 

import arcpy

fc = r"V:/Metro/STOP_CONSOLIDATION/STOPS.gdb/Stop_Database_Points"
fields = ["BEGINSTOPI", "METRO", "GpsLongitu", "GpsLatitud"]

with arcpy.da.SearchCursor(fc, fields) as cursor:
    for row in cursor:

      
arcpy.SelectLayerByLocation_management(point_lyr, overlap_type="WITHIN_A_DISTANCE", select_features=point_lyr, search_distance="1320 Feet", selection_type="NEW_SELECTION", invert_spatial_relationship="#")

 

[/code]

 

ps, as a side note, how do I add code tags to the new board?

Outcomes