CÓMO

Ordenar clases de simbología de valor único usando valores de un segundo campo en ArcGIS Pro

Last Published: September 26, 2023

Resumen

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.

Procedimiento

Use one of the methods below to sort the unique value symbology classes.

Edit the symbology from the Symbology pane

  1. In ArcGIS Pro, right-click the feature layer from the Contents pane and click Symbology.
  2. In the Symbology pane, on the Primary symbology tab, select Unique Values under Primary symbology.
  3. Select the first field for Field 1, and click Add field to add the second field.
  4. For Field 2, select the desired symbology field. Change the color scheme if needed.
The Symbology pane with Field 1 and Field 2 to select Unique Values.

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

The symbology sorted using values from a second field.

Use a Python script in ArcGIS Pro

  1. In ArcGIS Pro, click the Analysis tab on the top ribbon. Click the drop-down menu next to Python and select click Python window.
  2. In the Python window, insert the following commands:
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 
  1. Press Enter.

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

The symbology sorted using values from a second field through Python.

Id. de artículo:000026861

Obtener ayuda de expertos en ArcGIS

Contactar con soporte técnico

Descargar la aplicación de soporte de Esri

Ir a las opciones de descarga

Información relacionada

Descubrir más sobre este tema