Select to view content in your preferred language

UniqueValuesSymbology Python

325
1
10-24-2022 08:51 AM
Labels (3)
Davec43
Occasional Contributor

I need help! The version we're running arc on is having issues with applying symbology through the GUI as it will cause the system to crash. ESRI has released an update but our IT process to get the update approved is lengthy. I've found some alternatives like Apply Symbology from Layer but it doesn't always work. How would I using python apply "Unique_Values" and change the size of the sybmol?

I've tried this but I keep getting errors on line 2.

 

 

import arcpy
mxd = arcpy.mapping.MapDocument("current")
lyr = arcpy.mapping.ListLayers(mxd, "PTL")[0]
if lyr.symbologyType == "UNIQUE_VALUES":
  lyr.symbology.valueField = "Event"
  lyr.symbology.addAllValues()
arcpy.RefreshActiveView()
arcpy.RefreshTOC()
del mxd

 

 

 

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

you posted in the ArcGIS Pro section of Community.

"mapping" is now "mp"

Introduction to arcpy.mp—ArcGIS Pro | Documentation


... sort of retired...