0

I want to create a labeling with callout lines, therefore I use the geometry generator, like in this tutorial: https://gist.github.com/kgjenkins/1af82a8ffdc3c99bb886e6cd9cdc298f

It works fine and I can create the labling which I want.

But now I want to store the style and use it for another dataset. I can load the style to another dataset, but the callout lines are gone and I can not move the labels.

Does anyone know what I have to do, to use the style information with the callout line for another dataset?

2 Answers 2

3

That tutorial creates callout lines by putting the following expression in the geometry generator:

make_line(
  make_point($x, $y),
  make_point( "auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony" )
)

The expression relies on two auxiliary storage fields, which were created in Step 2: Move individual labels. It doesn't work if those fields don't exist. Your new layer doesn't have auxiliary storage fields, because you didn't do step 2.

Once you start manually moving labels for this layer, the necessary auxiliary storage fields will be created and the lines will appear.

2
  • If I move them manually and load the style information from the other dataset the lines appear, but not the same lines like in the other dataset. I only create new lines for the manually moved labels in the new dataset. Is there a way to use the callout lines from the first dataset?
    – joe_gerner
    Commented Oct 10, 2019 at 5:30
  • You could save the callout lines from the first dataset by using the geometry by expression tool to save them as a separate layer.
    – csk
    Commented Oct 14, 2019 at 15:22
2

I have encountered a bug where if I applied a style where label placement referred to auxiliary storage fields, to a layer that didn't initially have them, I would be unable to move the labels at all - because label x and y would refer to nothing (=red data-defined symbol if you look at label placement settings) and QGIS couldn't reset this when attempting to create auxiliary fields. I would have to clear the data defined override (not just deactivate) and then move the labels for it to work.

Alternatively perhaps move a label first for QGIS to generate the correct auxiliary fields before applying the style.

I think this behaviour will be irrelevant in QGIS 3.10 with native support for label callouts.

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.