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:
#proj_sr is defined here but omittedwhere_clause = fieldSRC = n OR fieldDST = n #simplified for webparser#create a new feature class based on selectionarcpy.Select_analysis('input', 'temp1', where_clause)#project selectionarcpy.Project_management('temp1', 'temp2', proj_sr)#PERFORM OPERATION ON PROJECTED SELECTION#append selection, and project to destination SRarcpy.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 rowsarcpy.MakeFeatureLayer_management('input', 'layerfile', where_clause)#delete rows selected above in layer filearcpy.DeleteFeatures_management('layerfile')This works. In my mind there should be a manner to do the following which would be more efficient.
#proj_sr is defined here but omittedwhere_clause = fieldSRC = n OR fieldDST = n #simplified for webparser#create layer file in order to select and delete specific rowsarcpy.MakeFeatureLayer_management('input', 'layerfile', where_clause)#project ACTUAL selection rather than a complete shapefile as was done earlierarcpy.Project_management('layerfile', 'temp2', proj_sr)#PERFORM OPERATION ON PROJECTED SELECTION#delete rows selected above in layer filearcpy.DeleteFeatures_management('layerfile')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?
أكثر...
I have a functioning arcpy script that does the following:
#proj_sr is defined here but omittedwhere_clause = fieldSRC = n OR fieldDST = n #simplified for webparser#create a new feature class based on selectionarcpy.Select_analysis('input', 'temp1', where_clause)#project selectionarcpy.Project_management('temp1', 'temp2', proj_sr)#PERFORM OPERATION ON PROJECTED SELECTION#append selection, and project to destination SRarcpy.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 rowsarcpy.MakeFeatureLayer_management('input', 'layerfile', where_clause)#delete rows selected above in layer filearcpy.DeleteFeatures_management('layerfile')This works. In my mind there should be a manner to do the following which would be more efficient.
#proj_sr is defined here but omittedwhere_clause = fieldSRC = n OR fieldDST = n #simplified for webparser#create layer file in order to select and delete specific rowsarcpy.MakeFeatureLayer_management('input', 'layerfile', where_clause)#project ACTUAL selection rather than a complete shapefile as was done earlierarcpy.Project_management('layerfile', 'temp2', proj_sr)#PERFORM OPERATION ON PROJECTED SELECTION#delete rows selected above in layer filearcpy.DeleteFeatures_management('layerfile')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?
أكثر...