I can't seem to make ApplySymbologyFromLayer work in ArcGIS Pro console, or in a scripting tool.
It works in an independant python script run in IDLE, but not when executed inside ArcGIS Pro GUI, neither from a scripting tool or the console.
For a basic "single symbol" symbology, this snippet should do the trick :
aprx = arcpy.mp.ArcGISProject("CURRENT") map = aprx.listMaps(your_map_name) map.addDataFromPath(path/to/your/layer) in_layer = map.listLayers(your_layer_name) symbology_layer = path/to/your/layer.lyrx arcpy.management.ApplySymbologyFromLayer(in_layer, symbology_layer, None)
It doesn't matter weither I try to apply the symbology from a lyrx file or from a data layer present inside map. Changing arcpy.management.ApplySymbologyFromLayer to arcpy.ApplySymbologyFromLayer_management doesn't change the output either. Neither does replacing the "None" as a last argument of the function by #, or nothing.
When executed, these code blocks say they worked, but the symbology is unchanged on the map. However, it appears to be changed in the symbology tab.
Here, I have tried to apply a grey, 7 pt symbology to this layer currently in pink. It is still pink in the map, and in the TOC, but if you go in the symbology panel for this layer, you see the symbology it is supposed to have. It looks like a bug to me for the symbology displayed on the map does not match the one you can see on the symbology panel.
Is there a way to make this command work when executed from within ArcGIS Pro console or from a scripting tool ?
I tried this at first using ArcGIS Pro 2.0. I recently updated to ArcGIS Pro 2.1, but the problem is still there. Also tried it on different computers and for different datas, and data types (points, lines, polygons)