So, I was reading The Swamp and came across a post about getting an alignment station/offset label to draw a line over to the alignment. There were a few options  but I came up with my own solution and I would like to share it here with all of you.

So, This is what the user wants the labels to look like (I drew this up myself so if you think it looks sloppy, the blame lies solely on me):

You can do this with a station label and just have it add the line and then the text but, what if you need to adjust the labels so they are farther from the alignment? Or on the other side? Well, this is what you get:

(select the image to see the animation)

So, what did I do? To start off with, I used a station/offset label with a line component. In this post, I’m going to focus on the line itself and not necessarily the text. Create a new label style, delete everything (I like to start out fresh) and add in a line component. The line will attach middle center of the feature as there is nothing else to attach to at this point. The end of the line will be calculated so don’t specify an ending point.

Now, to control the length and the rotation of the line, we have to create a couple expressions. The length of the line is determined by the offset value of the label location but, the length of the line is also dependent on the drawing scale. If the scale changes, the length of the line changes. I’m going to use a technique I wrote about in an earlier blog post HERE to avoid the length of the line changing when the drawing scale changes. Basically, I’m going to take the offset value and divide it by the drawing scale factor:

We also need to create an expression for the rotation of the line. I used the Instantaneous Direction of the line. The problem with that is  if I just use that for the rotation, it rotates the line the wrong direction. To overcome this, simply multiple the direction by a negative 1. Also, the line is going the wrong direction so we need to add a rotation of 180 degrees to the line so add in pi to the direction (remember it’s in radians).

Now, use these two expressions in the label style for the length of the line and it’s rotation:

Add some text components, some more line components, and perhaps a reference text component and you are good to go! Hope this helps everyone!