James Musselman | Applications Expert
In my previous blog posts I detailed ways to create disappearing labels and how to show stacked fractions. In this post I’d like to continue with this theme and show another common label style that has been requested. In this label style the requirement is to truncate the first digit of an elevation. An example of this is displaying an elevation of 123.45 as 23.45. The contours around the elevation imply the hundreds and therefore we can utilize this technique to save space while labeling or specifying elevations. To create this label we need to create an expression. We start the expression by moving the elevation decimal two places to the left. We accomplish this by dividing the elevation by 100. This leaves us with an elevation of 1.2345. Next we truncate this elevation and multiply it by 100. This removes the .2345 and converts the elevation back to hundreds. Finally we subtract this elevation from our original elevation. This leaves us with the hundreds removed from the original elevation. The expression looks like this:
{Surface Elevation}-100*TRUNC({Surface Elevation}/100)
And this is the resulting label:
The only downside to this technique is that whenever the truncated value is below 10 we lose the leading 0. There is a relatively simple fix for this. We can go back to the well and utilize a text height expression similar to the one we used in the crest and sag profile labels. Basically we start with an expression that analyzes our truncated value. If the truncated value is less than 10 we return a text height (i.e. 0.1/12). If the expression is greater than 10 we return a text height of 0. The expression looks like this:
IF({Remove Leading Figures}<10,0.1/12,0)
The “Remove Leading Figures” property is our truncate expression from earlier. We now edit our label style to create a text component containing a static 0. We set the height property of this component to our height expression and set the anchor component to the feature. Finally we set our Remove Leading Figures anchor component to the zero component we created.
Effectively how this works is that when we get to an elevation that is less than 10 our zero component appears and shifts the Remove Leading Figures component to the right. Here is what our final label looks like when the truncated value is below 10:
In my case I work in 1100 m to 1500 m range so I use an if statement and divide the elevation value by 1000.
IF({Surface Elevation}>999.999,{Surface Elevation}-((TRUNC({Surface Elevation}/1000)*1000)),{Surface Elevation})
Regards
Posted by: Dave M | 03/17/2015 at 07:23 PM