8

I have some line labels that are parallel to the line. When I manually move a label with the "moove label" tool, it sets the rotation of the label back to 0 Degrees. It is not parallel to the line anymore. Why is QGIS doing this and how do I stop this?

I'm using QGIS 3.4.13

enter image description here

2
  • to my knowledge you cannot move a line label manually. whenever i had to do it i had to split the line and remove the duplicated label manually. still, i would really appreciate a plugin for doing it, i really hope someone comes out with a proper answer...
    – Loumpa
    Commented Feb 6, 2020 at 14:49
  • @Loumpa, From View ~> Toolbars ~> Label Toolbar, you can manually move labels. Commented Feb 6, 2020 at 18:18

1 Answer 1

11

Because the rotation is actually being managed by the labeling engine.

When you define the placement by data (moving the label), there is no data for the rotation so it is zero.

But you can define a expression for the rotation (Edit... option of the Data defined, Rotation submenu):

line_interpolate_angle( 
    $geometry,
    line_locate_point(
        $geometry,
        make_point( 
            "auxiliary_storage_labeling_positionx",
            "auxiliary_storage_labeling_positiony"
            )
        )
    ) + 90

What are we doing? Retrieving the angle of the geometry at the nearest point of the label placement. The angle retrieved is from North, so we are adding 90 degrees for the label rotation.

For labels not moved, the rotation will be managed by the engine as before.

1

2
  • this would place a straight label, although with an angle. is there a way to move curved labels that follow curved lines, for example a river name label?
    – Loumpa
    Commented Feb 7, 2020 at 8:10
  • @Loumpa, Curved labels can be moved by the same way, but the label is treated as straight once it is moved. Commented Feb 7, 2020 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.