arcpy.management.ApplySymbologyFromLayer only works for python in window, not work in python toolbox?

489
0
08-08-2019 04:02 PM
JeanCheng
New Contributor

I am using ArcGIS Pro 2.4.0. Is there somebody, this bug has been fix it? I am still has this issue, arcpy.management.ApplySymbologyFromLayer only work python window, not python toolbox. So I have to use SDK C# to process if I want to use arcpy.management.ApplySymbologyFromLayer?

Pro 2.0 Bug "Apply Symbology From Layer" GeoProcessing Tool 

The issue has been fixed with the SDK only. The developers are aware that it is not working in Python and are looking into it. In my case, I had a simple point symbol to assign and the following steps managed to assign the symbology to my new layer:

  1. Add the lyrx file to the map: m.addDataFromPath(mysymbologylayerxpath)
  2. Get the layer's symbology: mysymbology=m.listLayers()[0].symbology
  3. Remove the layer from the map: m.removeLayer(m.listLayers()[0])
  4. Assign the symbology to my new layer in the map: new_layer.symbology=mysymbology

They are ways to update some of the symbology properties as well if needed. I did not need to in my case. I hope this helps until the issue gets resolved.

 

Christine Dartiguenave

Esri Water Resources Team

Tags (2)
0 Kudos
0 Replies