With a lot of help from gis.stackexchange.com I've created leader lines for point symbols. The lines are based on a geometry generator symbology:

Shortening line geometry using expression dialog in QGIS?

enter image description here

Now, I want to implement leader lines for moved labels. It's very importent to me, that the lines start at the center of the labels and end at the point coordinates (or vice versa).

-- Geometry generator:
    make_point(label_x, label_y),

Once again, the lines are covered by the labels:

enter image description here

enter image description here

Is there a way to address the label boxes and shorten the leader lines? I suppose this is quite a tricky question :/

  • Try changing the offset values – GISKid Mar 19 '17 at 20:43

Firstly, this is a really neat solution! I solved this using a database view (a bit of overkill, but it worked).

My suggestion is to use a background and fill on the label.

Or, looking here, you may be able to chain together a buffer and clip type solution.

difference(make_line(make_point( "x" ,  "y" ), $geometry), buffer(make_point( "x" ,  "y" ),1))

I just tested the above, and it works (I have different fields than you, but it proves the point). The use of the geometry generator is really flexible, so you could have the buffer distance a field too, dependent on symbology perhaps?

I'm not sure what's happening with point 'three', but I guess the anchor point is off to the left a bit.

disjoint label leader lines

  • I've to do some tests in the next few days, but I'm afraid that a background will not work for complex projects without covering some layers. – eclipsed_by_the_moon Mar 23 '17 at 18:18
  • Did you see the other part of my answer? I found something that will clip the leader lines for you @eclipsed_by_the_moon. – Alex Leith Mar 23 '17 at 21:37
  • Clipping leader lines for fixed size symbols works fine, but labels are an issue. I'll try to calculate the buffer distance dynamically, as soon as I find some time. – eclipsed_by_the_moon Mar 24 '17 at 15:53

I currently work on a fork of easy custom labeling plugin, to enable automatic creation of label and linked header line.

Have a look at : EasycustomLabaling

Download it, unzip it, and paste the 'EasyCustomLabeling' repertory in the the repertory of your QGIS plugin repertory. Reload QGIS.

  • Your plugin is really useful, but I would prefer geometry generator created lines that start at the center of the labels. – eclipsed_by_the_moon Apr 2 '17 at 20:11
  • I understand. For information, this can be set in the fields of the source layer when using this plugin (fields LblAlignV and LblAlignH) - Regards – patricev Apr 3 '17 at 16:10
  • Thx for the info, I'll test this at weekend. – eclipsed_by_the_moon Apr 6 '17 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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