Exercise 2: Use an expression to refine the labels

The labels show the street numbers of the parcels, but not the street names. You can use an expression to concatenate (combine) two properties. In this case, you concatenate the address (street number) and street name. You use the expression \n to add a line break, producing a multiline label.

Note: This exercise uses the map you edited in Exercise 1: Use a style to label features.

To use an expression to refine the labels

  1. Select the Parcels layer and click Style.
  2. In the Style Editor, click the cell under Feature Label in the lower half of the window.
  3. In the Style Label dialog box, for Text Content, select Use Expression.
  4. In the Create/Modify Expressions window, delete the current expression so the window is empty.
  5. Click Text FunctionConcat.

    An expression is inserted. It has two property placeholders.

  6. To replace the first property entry, select it and click Property at the top of the Create/Modify Expressions window. Select the numeric property ADDRESS.
  7. Place the cursor after the comma following the ADDRESS property.
  8. Type '\P', to move to a new line after the address number.

    Type the entry exactly as shown, with single quotes surrounding the \P, make sure you type a capital P, and enter a comma following the closing quotation mark.

  9. Click the Text Property entry and select Enter A Property.
  10. Select the text property STNAME.
  11. Delete the square brackets and the ellipsis (three dots) inside the brackets, as well as the final comma.
  12. Click Validate (at the bottom of the dialog box) to make sure that the expression is valid.
  13. Click OK.
  14. Click Apply and Close in the Style Label dialog box and close the Style Editor.
  15. Zoom in to the area around the cloverleaf in the middle of town.

Where you are now

The streets (drawing objects) display speed limits and the parcels (geospatial features) display full street addresses.

To continue this tutorial, go to Exercise 3: Display text along a curve.