HOW TO
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.
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.
var value = $feature.<field_name>;
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>" }, ];
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;
The image below displays descriptive text assigned to numerical attributes as labels in ArcGIS Pro.
Get help from ArcGIS experts
Download the Esri Support App