I have a large data set X(x1-xn) from which I must select consecutively the attributes A(a1-an) from X.fieldsSRC or X.fieldDST and project the selections.
I have a functioning arcpy script that does the following:
<inside loop incrementing n>
#proj_sr is defined here but omitted
where_clause = fieldSRC = n OR fieldDST = n #simplified for webparser
#create a new feature class based on selection
arcpy.Select_analysis('input', 'temp1', where_clause)
#project selection
arcpy.Project_management('temp1', 'temp2', proj_sr)
#PERFORM OPERATION ON PROJECTED SELECTION
#append selection, and project to destination SR
arcpy.Append_management('temp2', 'final_output')
#we must delete rows from source files otherwise we will treat them each twice
#create layer file in order to select and delete specific rows
arcpy.MakeFeatureLayer_management('input', 'layerfile', where_clause)
#delete rows selected above in layer file
arcpy.DeleteFeatures_management('layerfile')
<end of loop>
This works. In my mind there should be a manner to do the following which would be more efficient.
<inside loop incrementing n>
#proj_sr is defined here but omitted
where_clause = fieldSRC = n OR fieldDST = n #simplified for webparser
#create layer file in order to select and delete specific rows
arcpy.MakeFeatureLayer_management('input', 'layerfile', where_clause)
#project ACTUAL selection rather than a complete shapefile as was done earlier
arcpy.Project_management('layerfile', 'temp2', proj_sr)
#PERFORM OPERATION ON PROJECTED SELECTION
#delete rows selected above in layer file
arcpy.DeleteFeatures_management('layerfile')
<end of loop>
Obviously the arcpy.Project_management() function does not operate in the second code example. It's a rather large data set ('input') and recreating the feature class based on the selection each time does not seem efficient/necessary. It works but it is not fast.
Does anyone have a suggestion?