laptop and a wrench

Erro

The Map.addLayer command fails with ValueError when attempting to add a layer created with the MakeFeatureLayer_management and MakeRasterLayer_management tools.

Última Publicação: February 24, 2020 ArcGIS Pro
Número de ID do Erro BUG-000125587
EnviadoSeptember 26, 2019
Última ModificaçãoJune 5, 2024
Aplica-se àArcGIS Pro
Versão encontrada2.4.1
Sistema OperacionalWindows OS
Versão do Sistema Operacional10.0
StatusAs Designed

Informações Adicionais

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)

Solução Provisória

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)

Etapas para Reproduzir

ID do Erro: BUG-000125587

Software:

  • ArcGIS Pro

Seja notificado quando o status de um erro mudar

Baixe o Aplicativo de Suporte da Esri

Descubra mais sobre este tema

Obtenha ajuda de especialistas do ArcGIS

Entre em contato com Suporte Técnico

Baixe o Aplicativo de Suporte da Esri

Ir para as opções de download