ThinkGeo.com    |     Documentation    |     Premium Support

Force label to start at beginning of line

I have several line shapes that I want the label to start at the beginning of the line, not the center point. These are all straight lines, but rotated so they are not horizontal. I like the labeling of the line, but because the text labels in the middle, as I zoom in/out it is difficult to place where I want it.

If I could start the label at the beginning of the line, it would make it a lot easier to place correctly so it stays relative to the point it is labeling.

In Picture 1, I have the label where i want it at zoom level 20. The second picture shows it at zoom level 18.

It is difficult to see, but I have the line for the label starting where I want it. If I could get the text to alway start there, it would shift appropriately.

Hi Jake,

If you want to make the label shows well to see, I think you can set the xoffset and yoffset to the text style.

And you can try some other property of text style for example BestPlacement.

Wish that’s helpful.

Regards,

Ethan

xOffset can move the text, but the value needed will always be different depending on the length of your text.

What I need is a way to left justify the text on the line. Currently it is center justified on the line.

When thinkgeo labels a point shape, the text starts at the point and labels out. This means I don’t need to worry about the length of the label, it will always grow out from the point. Can we label a line the same way? Start the label at the start point of the line? Or the first vertex of the line?

Hi Jake,

We can modify some label behavior by set the property of text style, but we cannot force where the label will be drawn.

The default logic is the label will be drawn in the longest straight segment of the line, and if you change the property for example LabelAllLineParts or GridSize etc., the result will have some different, but we still cannot make sure where actual location of is the label.

So if you want to make the label shows on target point, we have a workaround for it.

You can build another layer, which only contains the target point, and you can set the label as its column value, and then render this text style but not render the point style, you can cover this layer above your original level, and the label should always render at target point.

Wish that’s helpful.

Regards,

Ethan