I am a student using PyCharm connected to ArcGIS Pro Python and using ArcGIS 3.0.3 provided by my school.
I am currently trying to apply a symbology layer to a polygon layer using arcpy.management.ApplySymbologyFromLayer() to change it. The script finishes without any errors, but the symbology is not applied. I've read a few posts complaining about similar issues.
I currently have two scripts: one for exporting a layer and the other that uses arcpy.management.ApplySymbologyFromLayer()
import arcpy
arcpy.env.workspace = r"D:\__ŠKOLA__\Střední\Gis\PROJECT_SCRIPT\PROJECT_SCRIPT\PROJECT_SCRIPT.gdb"
layer_name = "ExportedLayer"
in_symbology_layer = r"D:\__ŠKOLA__\Střední\Gis\PROJECT_SCRIPT\PROJECT_SCRIPT\ExportedLayer.lyrx"
# Výběr vrstvy
input_layer = "polygon"
attribute_field = "PO"
try:
arcpy.management.ApplySymbologyFromLayer(layer_name, in_symbology_layer, [["VALUE_FIELD", "PO", "PO"]], "UPDATE")
print("Symbology applied successfully.")
except Exception as e:
print(f"Error: {e}")