HOW TO

Assign descriptive labels to numeric attributes using ArcGIS Arcade dictionary in ArcGIS Pro

Last Published: May 2, 2024

Summary

In ArcGIS Pro, it is sometimes necessary to assign descriptive labels to numeric attributes using an Arcade expression. This simplifies data analysis, visualization, and makes the information more accessible for a wide range of users without affecting the existing numeric attributes in an attribute table.

In this article, the feature layer contains a numerical field named Forest_Type. Using an Arcade expression, descriptive labels are assigned to the numerical values in the field, describing the values the numerical field represents.

The image below displays the feature layer's attribute table containing the Forest_Type numeric field.

The Attribute table displaying the field with numeric values

Procedure

  1. Open the ArcGIS Pro project, add the layer, and create a label expression. Refer to Steps 1 through 4 in ArcGIS Pro: Write a label expression for instructions. Select Arcade for Language.
Note:
In the Contents pane, on the List By Labeling tab, ensure the selected feature layer and feature class check boxes are checked to display the labels.

The Selected feature layer and feature class check boxes are checked

  1. Insert and configure the expression below in the Expression box:
    1. Replace the <field_name> with the name of the numeric fields assigned with the descriptive labels. In this example, Forest_Type is used.
var value = $feature.<field_name>;
  1. Define an array to map integer values to corresponding labels. Replace <value1>, <value2>, <value2>, and <value4> with the numerical field values. In this example, 1, 2, 3, and 4 are used.
  2. Replace <label1>, <label2>, <label3>, and <label4> with labels to describe the numerical field values. In this example, Deciduous Forest, Coniferous Forest, Mixed Forest, and Regenerating Forest are used.
Note:
Add more mappings of integer values to corresponding labels if needed.
var labelMap = 
   { value: <value1>, label: "<label1>" },
   { value: <value2>, label: "<label2>" },
   { value: <value3>, label: "<label3>" },
   { value: <value4>, label: "<label4>" },
];
  1. Find the matching label for the value in the labelMap array.
var label = "Other"; 
for (var i in labelMap) {
    if (value == labelMap[i].value) {
        label = labelMap[i].label;
        break;
    }
}

return label;

Below is the full working code of the Arcade expression.

var value = $feature.Forest_Type;

var labelMap = [
    { value: 1, label: "Deciduous Forest" },
    { value: 2, label: "Coniferous Forest" },
    { value: 3, label: "Mixed Forest" },
    { value: 4, label: "Regenerating Forest" },
];

var label = "Other"; 
for (var i in labelMap) {
    if (value == labelMap[i].value) {
        label = labelMap[i].label;
        break;
    }
}

return label;
  1. Click the Verify button to validate the expression.
  2. Click Apply to run the script.
The Arcade expression configuration for labels

The image below displays descriptive text assigned to numerical attributes as labels in ArcGIS Pro.

The descriptive labels on the map

Article ID: 000032438

Software:
  • ArcGIS Pro 3 1
  • ArcGIS Pro 3 0
  • ArcGIS Pro 3 2

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options