Tengo un gran conjunto de datos X(x1-xn) a partir de la cual debo seleccionar consecutivamente los atributos(a1-an) de X. fieldsSRC o X. fieldDST proyecto y de las selecciones.
Tengo un funcionamiento arcpy script que haga lo siguiente:
<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>
Esto funciona. En mi mente no debe ser una manera de hacer lo siguiente, que sería más eficiente.
<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>
Obviamente el arcpy.Project_management() la función no operan en el segundo ejemplo de código. Es un gran conjunto de datos ('input') y volver a crear la clase de entidad que se basa en la selección cada vez que no parece eficiente y necesario. Funciona, pero no es rápido.
¿Alguien tiene una sugerencia?