You can label each parcel with text that is determined by an expression. In this exercise, you will 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.
To add labels using expressions
- 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.
- In
the Style and Label Editor, click Property
To Display, scroll down to the bottom of the list, and
click Expression.
- To
create the two-line label, enter Concat
(ADDRESS, Concat ('\n', STNAME))
The Concat operator combines multiple properties and uses the '\n' argument to insert a line break.
- Validate the expression.
- Click OK in the Style and Label Editor.
- In the Style Editor, click the entry under Feature Label for the second rule in the theme.
- In
the Style and Label Editor, click Property
To Display, scroll down to the bottom of the list, and
click the Concat expression you created
earlier. Click OK twice.
Once you create an expression for a label, you can select it from the Property To Display list. You don’t need to re-create it each time.
- Repeat steps 5 and 6 for each entry in the theme for which you want labels.
- Close the Style Editor to see the changes.
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 MapGuide