Número de ID del error |
BUG-000125587 |
Enviado | September 26, 2019 |
Última modificación | June 5, 2024 |
Relacionado con | ArcGIS Pro |
Versión encontrada | 2.4.1 |
Sistema operativo | Windows OS |
Versión de sistema operativo | 10.0 |
Estado | As Designed
Tras revisión realizada por el equipo de desarrollo, se ha determinado que este comportamiento es acorde con lo designado. Consulte los detalles en la sección Información adicional.
|
Información adicional
The MakeFeatureLayer_management tool does not return a layer object but instead a result object. Extract the layer from the result using the appropriate index. In this case, it is [0].
The object at index 0 in the result object is the layer to add. Use the following code:
temp = arcpy.MakeFeatureLayer_management(r"C:\Temp\GreatLakes\GreatLakes.gdb\GreatLakes", "TestOutput")[0]
p = arcpy.mp.ArcGISProject('current')
m = p.listMaps('Map')[0]
m.addLayer(temp)
Solución alternativa
The object at index 0 in the result object is the layer to add Use the following code:
temp = arcpy.MakeFeatureLayer_management(r"C:\Temp\GreatLakes\GreatLakes.gdb\GreatLakes", "TestOutput")[0]
p = arcpy.mp.ArcGISProject('current')
m = p.listMaps('Map')[0]
m.addLayer(temp)
Pasos para reproducir