laptop and a wrench

不具合

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

最後に公開された状態: February 24, 2020 ArcGIS Pro
不具合 ID 番号 BUG-000125587
送信されましたSeptember 26, 2019
最終更新日June 5, 2024
適用対象ArcGIS Pro
見つかったバージョン2.4.1
オペレーティング システムWindows OS
オペレーティング システムのバージョン10.0
ステータスAs Designed

参考情報

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)

対処法

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)

再現の手順

不具合 ID: BUG-000125587

ソフトウェア:

  • ArcGIS Pro

バグのステータスが変更されたときに通知を受け取る

Esri Support アプリのダウンロード

このトピックについてさらに調べる

ArcGIS エキスパートのサポートを受ける

テクニカル サポートへのお問い合わせ

Esri Support アプリのダウンロード

ダウンロード オプションに移動