Using Expressions to Label Features

To use expressions in labels

  1. Display the Style Editor for the feature or layer you are labeling.
  2. Under Feature Label, click for the appropriate entry.

    If you are theming this feature, there is one entry for each theme rule. Click the entry for a rule that displays labels.

    If your layer supports multiple geometry types (for example,point, line, and polygon), scroll down and click the Style cell for the appropriate geometry type.

  3. In the Style Label dialog box, do one of the following:
    • To create a label with multiple lines, select Multiline.
    • To create single-line labels, select Advanced Placement. Text follows the outline of a linear feature and displays a single label, even if there are multiple line segments. The text shrinks to fit the length of the line.

    In either case, you can specify an expression for the content of the label.

  4. To create an expression for the label content, click Property To Display and scroll to the bottom of the list. Click Expression.
  5. In the Create/Modify Expressions dialog box, enter the expression.

    If you selected Multiline, use '\n' to insert a line break.

    The following example shows a three-line label. It displays the street name on the first line, the area of the parcel on the second line, and the APN code on the third line.

    Concat ( STNAME , '\n Area: ', AREA , '\n APN: ' , APN )

    Note:

    The label uses the Concat operator, which combines multiple properties and text strings and can include spaces and line breaks. For more information, see Text Functions.

    The static text (in this case, the words “Area:” and “APN:”) are surrounded by single quotes. Including a space after the text strings inserts a space between this static text and the dynamic property that follows it.

    The \n entry moves the subsequent text to a new line. The expression results in the following label:

    For help with any expression element, see Creating Expressions - Reference.

  6. Click OK to apply the expression to the labels.