Geographic Information Systems Asked by Gustavo on December 24, 2020
I cannot make the ApplySymbologyFromLayer_management work on ArcGIS Pro by any means. The following code runs smoothly but does not give any results:
import arcpy
aprx = arcpy.mp.ArcGISProject("CURRENT")
aprxMap = aprx.activeMap
layer = aprxMap.listLayers()[0]
symblayer = r"C:referencelayer.lyrx"
arcpy.ApplySymbologyFromLayer_management(layers, symblayer)
aprx.save()
Any ideas?
To test this in ArcGIS Pro 2.5.0 I used a project with one map and one polygon layer in it.
aprx = arcpy.mp.ArcGISProject("CURRENT")
aprxMap = aprx.activeMap
layer = aprxMap.listLayers()[0]
symblayer = r"C:Tempreferencelayer.lyrx"
arcpy.ApplySymbologyFromLayer_management(layer, symblayer)
aprx.save()
I think the comment from @KHibma was probably correct in that the main difference between my code and yours is the attention I paid to using a variable named layer
in two places rather than setting layer
and then trying to retrieve a value from layers
.
Answered by PolyGeo on December 24, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP