1

In QGIS, how to control where the the connector line should join the line feature ?

It seems to automatically adjust to either the middle or an end of the line feature, depending on the label's position. But i don't find any option to control it better. Without this option, it can become a mess, hard to see which connector joins which feature:

enter image description here

I only find the "Label anchor point" option, which controls where the connector line should join to the label text. I'm looking for a similar option on the other side of the connector line.

Does this option exist ?

My label settings are shown below:

enter image description here

enter image description here

2
  • In QGIS 3.34 I've been able to move the label around manually and the callout line automatically connects to the nearest point on the line geometry. Same with the automatically placed labels (when a sufficient distance from line is specified so that the callout line is drawn) - position of the label follows the Label Anchoring setting in the Placement tab. See example here. Maybe your label placement uses geometry generator? Could you share your labelling settings (Placement tab and Callouts tab at least)?
    – she_weeds
    Feb 21 at 12:12
  • Thank you for your answer. Actually I'm now observing that i have the same behaviour. The problem is that, due to my layout contraints, the place where i put my labels puts the callouts lines where it's not obvious to see to which feature it connects (mostly at the end of my lines, where other lines sometimes also connect). Then it would be easier to have an option to manually control it, do you know if it exists ? My labelling settings are here and here
    – greg
    Feb 21 at 16:22

1 Answer 1

3

You can move label callouts manually using the Move Label tool.

  • Hover over either end of a callout to see a red square anchor, click and drag, then click again to release.

  • To reset the callout to its default location, click and drag the callout anchor again but this time press Delete while it is active (highlighted green).

    enter image description here


However... first you need to fix a bigger issue: all the data-defined overrides for your label callouts are invalid (red). It's likely your Label Anchoring Settings (Ancrage de l'étiquette > Paramètres in your screenshot) have invalid overrides as well.

Why this happens

The invalid icon usually shows up when you apply a style with overrides referring to a field that doesn't exist in your current layer.

This happens a lot with labels because using the label toolbar to move/customise individual labels and callouts auto-generates auxilliary fields that are auto-applied the data-defined override, but the user doesn't usually notice either the fields or the overrides.

So when a style is copied/saved from such a layer, then applied to a new layer that has not yet had these aux fields generated, the data-defined override fails. Crucially, once the style is applied, even if you do set up the aux fields later, the override continues to not work for some reason.

Solutions

There's two ways to fix it:

(a) Click on every single invalid data-defined override and select Clear, or

(b) Let the layer have a simple label style with no overrides (maybe paste one from a new scratch layer), move just one label and callout so the relevant aux fields are all generated, then apply the intended label style

If that layer's style was from a .qml you may wish to replace it - maybe do (a) on your layer and save that as the .qml, so it has none of the aux field overrides in the style definition. Either that, or be sure to only apply the .qml after you have generated the aux fields.

2
  • Thanks a lot for your very complete answer. How/where can i "click on every single invalid data-defined override ?" Solution B worked.
    – greg
    Feb 28 at 19:21
  • Invalid data defined overrides are the red squares you see in your label settings screenshots. You can click on them and a menu appears that includes the option to Clear the override (not sure what it's called in French but it should be the option right at the bottom of the list). Dont forget to click the "Paramètres" button in your second screenshot and clear the overrides there too.
    – she_weeds
    Feb 28 at 23:30

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.