Exercise 2: Add labels that use an expression

You can label each parcel with text that is determined by an expression. In this exercise, you create a label for each parcel that displays the parcel address on two lines.

The Style Editor should still be open from the previous exercise.

Note:

This exercise uses the map you modified in Exercise 1: Create a theme.

To add labels using expressions

  1. In the Style Editor, click the entry under Feature Label for the first rule in the theme.

    Because you are theming the Parcels feature, you have one entry for each theme rule.

  2. In the Style Label dialog box, click Add Label.
  3. For Text Content, scroll down to the bottom of the list, and click Use Expression.

    You can use an expression to determine the text for labels.

  4. To create the two-line label, enter CONCAT ( ADDRESS , '\P', STNAME )

    The Concat operator combines multiple properties and uses the '\P' argument to insert a line break.

    Note: For enhanced styles, use '\P' but for standard styles, use '\n'. Make sure you use the capitalization shown.
  5. Validate the expression.
  6. Click OK in the Create/Modify Expressions window.
  7. Click Apply and then Close in the Style Label dialog box.
  8. Repeat these steps for each entry in the theme for which you want labels.
  9. Close the Style Editor to see the changes.

Where you are now

You themed the Parcels layer, using a calculated property as the basis for the theme. You added labels whose content was determined by an expression.

To continue this tutorial, go to Lesson 5: Publishing Your Styled Map to Autodesk Infrastructure Map Server.