Select to view content in your preferred language

Rotate labels for line features

1785
10
05-30-2022 06:12 AM
Status: Needs Clarification
Labels (1)
IlkaIllers1
Frequent Contributor

I have a line feature, with labels along each line. The labels are supposed to be horizontal - but rotated by 180° so they are upside down. However, it isn't possible to rotate the label itself or the symbol as it is e.g. for points:

Points:

IlkaIllers1_1-1653916167490.png

Polylines:

IlkaIllers1_2-1653916230894.png

In the Symbol settings, "Rotation" is greyed out:

IlkaIllers1_3-1653916291857.png

 

It would be great to rotate line labels as well - either by a specified field or a set degree.

Tags (2)
10 Comments
RichardHowe

It would be nice. As a workaround (if line direction isn't important to your data) then you could tick the "Align label to direction of line" tickbox on the position tab and draw them in the appropriate direction. I have used this "hack" a few times, but agree it isn't ideal.

CraigWilliams
Status changed to: Needs Clarification

I'd like to know more about this use case if you could elaborate on it. This is not something we've seen requested much.

As for the symbol UI - rotation is disabled in this case because the label algorithm controls the rotation, so this case would need to be modeled in placement.

IlkaIllers1

@RichardHowe: thanks, that is a great suggestion for the 180° rotation. However, if the lines are already drawn, you need to manually reverse the direction of each line. Also, the rotation is limited to 180° - which I needed in this case but a different rotation might be wanted in another case. 

@CraigWilliams: basically I would like the possibility to rotate my labels by simply typing in a degree or specifying a field in the settings. This is possible with annotations for example by changing the field "angle".  

JesseWickizer

Here are a couple ideas that admittedly aren't exactly what you're asking for but may help you achieve what you need: 

1) Convert your labels to annotation, then change the Angle attribute of the annotation features to 180.

2) If all of your labels need to be rotated 180 degrees, label your map as usual, but rotate the map 180 degrees. 

IlkaIllers1

@CraigWilliams maybe I misunderstood your request on what exactly to clarify? 

The map concerned was showing groundwater levels and they had to be upside down to show the groundwater flow direction. 

JesseWickizer

Here's another idea that may help label your lines depending on how your data is structured. When labeling lines you can use the Contour placement labeling placement style and specify the label alignment that works for your data. Here's an example with bathymetry lines. 

JesseWickizer_1-1659452383763.png

In this case the depth values are positive so "uphill placement" places these upside down in this area of the map.

JesseWickizer_0-1659451883518.png

 

JohnMcGlynn

I agree. For point based chainage markers the chainage text can be aligned with the direction of the line. E.G:

ChainagesChainages

However with line markers the best possible is horizontal:

HorizontalHorizontal

It would be nice to be able to align the text based on a field value, as it is for points.

 

 

JohnBrand

Was a solution ever created for this issue?

CraigWilliams

@IlkaIllers1 Sorry for the delay in replying. What's unclear to me is whether these are straight labels along the line or horizontal near the line. You use both terms. I'm also not sure why aligning to the direction of the line doesn't work because that's the stated original reason for wanting to rotate them according to direction. Would it be possible to provide a picture of a map showing exactly you're looking for?

IlkaIllers1

@CraigWilliams I basically would like the option to define a rotation - with a set value, a field value or an expression - for the labels of a line. 

Aligning to the direction of the line works if I want a specific rotation, but doesn't allow me the freedom to choose the rotation exactly. Also, sometimes a series of line might not all be drawn from right to left for example, but sometimes right to left and sometimes left to right. This means manually adjusting the direction for each of those lines to get consistent labeling.

I hope this makes sense now. Unfortunately, I am unable to provide a map due to client confidentiality.