Trunc’s Aren’t Just for Elephants

They are for point elevations too. A short one this time. A client asked me to create a point label style that truncates the numbers to the left of the decimal to 2 digits. for example:

12.34 stays 12.34
349.22 becomes 49.22
6299.45 becomes 99.45
… you get the picture.

image

Check out the solution after the jump.

I figured it could be accomplished using an expression, but which one? After a lot of head pounding I managed to scratch out something that works.
{Point Elevation}-((trunc({Point Elevation}/100)) *100)

Click here to download a drawing with the expression and labels.

7 comments

  1. Greg Perry says:

    Less tedious than writing expressions for different datums.

  2. Greg Perry says:

    Very useful. Can also apply this to contour labels if needed. Thanks.

  3. Kristopher Kinzie says:

    Greg…do you mind telling me how you made this work for contour labes?

  4. Romeo Baylosis says:

    Specifically, how do you edit a surface spot elevation style so this works. Thanks.

  5. Matt Kolberg says:

    To edit the spot elevation style you:

    1. in the settings tab, under surface->label styles->spot elevation, create the expression like above except instead of point elevation it will be Surface Elevation.
    2. create the new spot elevation label style and change the contents (in the layout tab) by clicking the contents cell and clicking the 3 dots symbol (ellipsis)
    3. in the text component editor, you will see your expression in the list of possible properties, add that

    And that’s about it.

    Matt

  6. Brandon Rice says:

    Excellent trick. I never would have found that myself. Thanks for the help.