Maps can display large amounts of geographic data in layers that generally overlap. The way you draw your layers helps to describe and identify features, but sometimes you need more than just a particular symbol or color to convey what you want to say with your map. This is when labeling features can help. Labels are short pieces of text that describe features in a layer and help your audience understand the features they see. The text for a label is usually derived from the layer attributes. Select one or more attributes you want to show—for example, the name or type of feature.
You can also create a custom attribute expression written in Arcade to label a feature layer. For example, an Arcade expression might be created to derive a yearly sales figure for individual sales territories by summing the value of monthly sales fields. If an expression is already available for the layer, you can use it for labeling. You can also edit your Arcade expression directly in Map Viewer.
Map Viewer automatically places labels on the map on or near the features they describe. You can control the text size, color, and style to help differentiate labels from different layers. You can also specify at what zoom levels the labels are drawn on the map.
You can create labels for features in the following types of layers:
- Feature layer (hosted andArcGIS Server)
- ArcGIS Server map image layer that supports dynamic layers
- Individual layers from an ArcGIS Server map image layer
- OGC WFS layer
- CSV on the web
- Layers from files
- Verify that you are signed in and have privileges to create content.
- Open the map in Map Viewer, click Details, and click Contents.
- Browse to the sublayer that contains the features you want to label, click More Options , and click Create Labels.
- Check the Label Features box if it is not already checked.
- Do one of the following to specify the label text:
- From the Text drop-down menu, select a field value to use as your label. You can also type static text instead of or in addition to the field value.
- To use a custom Arcade expression that has been created for the layer, select it at the bottom of the Text drop-down menu. If you want to edit the expression or its name, click the Edit Expression button and use the editor window to edit it.
- If you want to create a new Arcade expression, select New Expression from the Text drop-down menu and use the editor window to create your expression, including giving it a name. If an expression was previously created for the layer for use in styling or pop-ups, you can use it to build your expression by selecting it from the Existing tab in the editor window.
If you need help with any of the Arcade functions, click the Information button beside the function to see reference information about the function.
- Do any of the following to specify how the labels should be displayed:
- Make any adjustments to the size, style, and color of the text.
- Check the box to add a halo outline around the text and choose the width and color of the halo.
- Choose how to align the label relative to the feature.
- Adjust the visibility of the labels at different zoom levels. To set the maximum and minimum zoom levels for label visibility, drag one or both handles on the Visible Range slider. Words like Country, City, and Building can assist you in choosing the best zoom levels. If you want to set a more precise scale, click the drop-down menu beside the scale labels and type a representative fraction or choose a predefined zoom level.
- Click OK when you are finished creating your labels.
- Browse to the layer that you want to save, click More Options , and click Save Layer to save the configuration as a property of the item. You can only save item properties if you own the layer or if you save it as a new item.
- If you have more than one layer with labels, you can organize the layers to affect how the labels are displayed. The layer at the top of your map contents is labeled first and has the most labels. The layer under your map contents is labeled next and has fewer labels, and so on.
- Click Save from the top of Map Viewer to save the labels to the map.
- To remove or change the labels, click More Options , click Manage Labels, apply the change, and click OK.
- Map Viewer places as many labels on the map as possible without overlapping them. Thus, in areas where features are tightly clustered, some features may not get labeled.
- Labeling priority follows the layer order in your map from top to bottom. Layers at the top are labeled first and will have the most labels. There is no guarantee that the labels will be positioned exactly where you want them. Thus, dynamic labeling is best suited for maps where you don’t need precise control and only want to label a few layers.
- When creating labels for all supported layer types other than ArcGIS Server map image layers that support dynamic layers, you can change how dates and numbers are displayed if the label uses a field value that has date or number as the field type. If your date field includes time data, you can also change how time is displayed. For these layers, labels display the same date and number formatting as configured in pop-ups. You can change the display format of a date or number field by selecting the field in the Configure Attributes pop-up of the Configure Pop-up pane. Click Manage Labels and click OK to apply the new formatting to an existing label.
- When you create labels based on a date or number field for ArcGIS Server map image layers that support dynamic layers, the labels are displayed with the same date or number formatting used in the field. Any changes made to the date or number display format during pop-up configuration are ignored when labels are generated for this layer type.
- Map Viewer does not support multiline labeling.
- Labels authored in ArcGIS Pro may look different in Map Viewer.