5

In QGIS 3.22.8 I have 100s of linear features on a map. I want to label them horizontally, but don't want the label sitting over the line. I can find the Horizontal placement setting, but no offset setting.

Currently, my labels look like this:

enter image description here

How can I shift these labels to the right so the text starts next to the line feature? I'm not keen to use workarounds, such as padding the label text with a load of white space before the text.

My label settings:

enter image description here

enter image description here

4
  • 2
    Have you tried changing the Label Anchoring settings (in the middle of the Placement tab)?
    – Bera
    Commented Feb 3, 2023 at 17:58
  • 1
    If no better answer you can manually place each label (obviously this is only doable for a reasonable number of label)
    – J.R
    Commented Feb 3, 2023 at 18:05
  • 1
    @BERA label anchoring only sets where on the line the label will be (start middle or end). There's no offsetting there.
    – Theo F
    Commented Feb 3, 2023 at 19:31
  • @J.R sure, but looking for a solution for 100s of features. Will clarify in OP
    – Theo F
    Commented Feb 3, 2023 at 19:32

1 Answer 1

5

Use a label placement based on Geometry Generator: create a (small) buffer around the lines and use placement Outside Polygons.

How to do:

In Placement settings, set the Mode to Outside Polygons, then check the box next to Geoemtry Generator and add this expression: buffer($geometry, 0.6) and below select Polygon/MultiPolygon. Change the size of 0.6 to fit your needs.

enter image description here

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.