操作方法
There are many types of symbology to choose from when symbolizing feature classes, depending on the dataset. One of them is the unique value symbology type that can be based on one or more attribute fields in the dataset. The instructions provided describe how to sort unique value symbology classes using values from a second field in ArcGIS Pro.
Use one of the methods below to sort the unique value symbology classes.
Edit the symbology from the Symbology pane

The image below shows the symbology is sorted using values from a second field.

Use a Python script in ArcGIS Pro
p = arcpy.mp.ArcGISProject('CURRENT')
m = p.listMaps('Map')[0] #Update the Map parameter to the Map's name
l = m.listLayers('Layer')[0] #Update the Layer parameter to the desired layer
#isolate the symbology of the selected layer
sym = l.symbology
#set the symbology as unique values
sym.updateRenderer('UniqueValueRenderer')
#specify the desired fields for the symbolizing
sym.renderer.fields = ['Field 1', 'Field 2']
#select a colour ramp
colorRamp = p.listColorRamps("Cyan to Purple")[0]
#set the colour ramp
sym.renderer.colorRamp = colorRamp
#loop through each of the groups of features
for grp in sym.renderer.groups:
for itm in grp.items:
#Grab the first name in the list
transVal = itm.values[0][1]
#set the label as the name selected above
itm.label = str(transVal)
#update the layer symbology
l.symbology = sym
The image below shows the symbology is sorted using values from a second field through Python.

文章 ID: 000026861
获取来自 ArcGIS 专家的帮助
立即开始聊天