About specifying text for labels

Label text strings are derived from one or more feature attributes. Labels are dynamic, so if feature attribute values change, the labels also change. When you turn on labeling, features are initially labeled based on one field—for example, on a meteorological map, you might label weather stations with daily precipitation. This single field-based label is set on the Label Manager.

NoteNote:

This label field defaults to the first field of string type that contains the text "name" in its name (case insensitive). If no field with that text in its name exists, it defaults to the first field of string type, then the first field of integer type, then the first field of any type.

You can add attribute fields to your labels. For example, you might label your weather stations with both daily precipitation and maximum wind speed. Whether your labels are based on one attribute field or many fields, the statement that determines your label text is called the label expression. Each label class has its own label expression.

Learn more about creating label expressions

You can insert your own text in the label expression to have it appear with your labels on the map. For example, on your weather map, you could add abbreviated measurement units to each label (for example, in for inches and MPH for miles per hour). You can also use Python, VBScript, or JScript in your label expression to change how the text is displayed. For instance, you could insert a function to make precipitation values appear on one line of text and wind speed values appear on a second line.

Label placement example

You can further control how text appears on the map using ArcGIS text formatting tags. Text formatting tags let you specify different text display properties for different portions of your label text. For example, you might show precipitation values with italicized, blue text and wind speed values in regular, black text.

Label placement example

Using advanced label expressions is a more powerful option. Using an advanced label expression, you can add any Python, VBScript, or JScript logic to your label expressions, including conditional logic and looping. For example, you could produce labels that have only the first letter of each word capitalized, regardless of how the text strings are stored in the attribute fields.

Both regular and advanced label expressions can be saved as label expression files (.lxp), which can be loaded into other layers or maps.

Related Topics

3/3/2014