I have a script using a Search Cursor to iteratively make copies of individual features for use as inputs in a geoprocessing tool, e.g.,
fc = <feature class>
arcpy.MakeFeatureLayer_management(fc, 'layer')
with arcpy.da.SearchCursor('layer', [<field>]) as cursor:
for row in cursor:
arcpy.SelectLayerByAttribute_management('layer', 'NEW_SELECTION', '{}={}'.format(<field>, row[0])
arcpy.CopyFeatures_management('layer', 'feature')
arcpy.<geoprocessing tool>('feature', <output>)
It runs, but is running on a large input feature class over a large raster. I thought I could speed up the script by dropping the feature copying, but can't figure out how to use a cursor row as a geoprocessing input. Is this possible?
Executing the geoprocessing tool on selected features appears to use the extent of the entire input feature class in the raster analysis, slowing the script down dramatically.