QGIS Labeling – Offsetting Horizontal Line Labels in QGIS for Better Map Readability

labelinglinelinestringoffsetqgis

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

Best Answer

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

Related Question