Maps can display large amounts of geographic data in layers that generally overlap. The way you style layers can help describe and identify features. When you want to say more than what a symbol or color can convey, however, you can use labels on features. Labels are short pieces of text that describe features in a layer and help your audience understand those features.
Map Viewer (formerly a separate beta installation but now included with the portal by default) automatically places labels on the map on or near the features they describe. Longer text strings automatically wrap to create a multiline label. The text for a label is typically derived from the attributes in the layer. When you enable labels on a layer, you create one or more label classes, which allow you to customize the labels. For example, you can create two label classes, each showing a different attribute value with different label styling applied.
Note:
You can also create a custom attribute expression written in ArcGIS Arcade to label a feature layer. For example, you can create an Arcade expression to derive a yearly sales figure for individual sales territories by summing the value of monthly sales fields. If an existing expression is available for the layer, you can use it for labeling. You can also edit the Arcade expression directly in Map Viewer.
In Map Viewer, you control the label style, including font, text size, placement, and so on. You can also apply a label filter to only display labels on features that meet the filter criteria.
By setting a visible range, you can specify the zoom levels at which the labels are drawn on the map. Setting a different visible range for each label class allows you to define how labels are shown at different map scales. For example, a label can reveal more detailed information as you zoom in on the map.
Apply labels
When you turn on labeling for a layer and add a label class, labels automatically appear on the map using a default label configuration. As you make changes to the label configuration, the changes are immediately shown on the map. This allows you to experiment with label style and other settings to achieve the desired look and message of your map.
To enable and apply labels to features, do the following:
- Confirm that you are signed in and, if you want to save your changes, that you have privileges to create content.
- In Map Viewer, open the map containing the layer or add the layer directly.
- On the Contents (dark) toolbar, click Layers .
- In the Layers pane, select the layer on which you want to apply labels.
- On the Settings (light) toolbar, click Labels .
- In the Label features pane, turn on the Enable labels toggle button.
- Click Add label class and do any of the following to create the labels:
- Click the Label field selector, select a field, and click Replace to use a different attribute field for the label.
Tip:
You can use a custom attribute expression written in Arcade instead of an attribute field. Click Use expression and use the editor window to create the expression.
You can also use existing expressions to build new expressions; however, some variables may not work in all profiles—for example, an expression created for pop-ups may not work for styles. To use an existing expression, select it from the Existing tab in the editor window.
- Click Edit label filter to display labels on a subset of features only, and click Add expression to set up the filter. For more information, see Apply filters.
- Click Edit label style to change the style of the labels, including the font, text size, and placement. In the Label style window, set the label style options.
- Adjust the Visible range slider to change the visible range for the labels.
- Click the Label field selector, select a field, and click Replace to use a different attribute field for the label.
- Repeat the previous step to configure additional label classes as needed.
Tip:
To copy the properties you specified for the label class and apply them to a new label class, click Options next to the label class name and click Duplicate.
- Optionally, click Options next to the label class name, click Rename, type a new name in the text box, and click OK to change the name of a label class.
- Optionally, click Options next to the label class name and click Delete to delete a label class.
- Close the Label features pane when you're finished.
Customize the label style
When configuring labels for features in a layer or for point clusters (if the point layer has clustering enabled), you can customize the style of the labels, including the font, text size and color, placement, offsets, and halo effect.
- Depending on whether you're customizing labels for features or for point clusters, do one of the following:
- Follow the first six steps of the Apply labels section above and click Add label class to set the label style for features.
- Follow the first four steps of Configure cluster labels to set the label style for point clusters.
- Click Edit label style.
- In the Label style window, do any of the following:
- Click the Font selector and choose a different font for the labels.
- Click the Size selector and choose a different size for the label text.
- Click the color chip and choose a different color for the label, or type the hexadecimal value representing the color.
- Optionally, turn on the Allow overrun toggle button to display labels for line features that are shorter than the label.
- Optionally, for line features, turn on the Repeat label toggle button and set a Label repeat interval value.
- Click the Placement selector and choose a different placement location of the label in relation to the feature or cluster.
- Adjust the horizontal offset (Offset X) or vertical offset (Offset Y) values to change the distance between the label and its associated feature or cluster. You can use the up and down arrows to change the values or type a positive or negative value for each offset.
- Turn on the Halo toggle button and specify a halo color and size for the label.
- Close the Label style window when you're finished.