I have labelled a points layer by defining a line between points and labels, because points were overlapping too much. Using additional columns in the points layer attributes table (LABEL_X and LABEL_Y), I can move the labels manually.

To achieve that, I have added a 'Geometry Generator' in the Style section of the layer's Properties dialog. To define the geometry generator, I have used the following expression where $x and $y are the features' coordinates and LABEL_X and LABEL_Y are the labels' coordinates:


My issue is that labels do not align properly with the line connecting them to features. There seems to be a default offset. How could I correct it? The images below show (1) the way labels display inside the map canvas and (2) the Geometry Generator definition.

Image 1 : Labels with connecting-to-features lines

enter image description here

Image 2 : Geometry Generator definition

enter image description here

  • how did you define the placement of the label? does it look better if you choose 'offset from point' set to 0?
    – PieterB
    Sep 14, 2017 at 9:12
  • Placement is Around Point, but the result is the same with Offset from Point. I have tried to change the parameters within this section, without success...
    – wiltomap
    Sep 14, 2017 at 9:15

1 Answer 1


I'm not sure of my answer but i think i had something very similar recently. The labelling of your point layer is "data defined", did you check the horizontal and vertical alignment ? both properties have predefined values that should be chosen among ([Left|Center|Right]) or ([Bottom|Base|Half|Cap|Top]).

It seems to me that your labels are currently left-aligned ... no ?

  • That's it! Many thanks... Instead of adding new columns to my points layer's attributes table, I clicked the both drop-down menus for Horizontal and Vertical alignments and then clicked Edit.... I just had to enter 'Center' for horizontal parameter and 'Half' for the vertical one (as explained in the Description section inside the drop-down menu). Display is now perfect!
    – wiltomap
    Sep 14, 2017 at 9:35
  • glad it helps ! ... just a question : do u generate the "LABEL_X" and "LABEL_Y" manually ... or ?
    – Snaileater
    Sep 14, 2017 at 9:41
  • Yes, I just change the position of certain labels manually in the map canvas and these columns update automatically with the new label coordinates.
    – wiltomap
    Sep 14, 2017 at 11:53

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.