2

I used the following link to create labels with leaders, but since I have a polyline layer I used a different expression for the Geometry Generator:

make_line(
  centroid($geometry),
  make_point("auxiliary_storage_labeling_positionx", "auxiliary_storage_labeling_positiony")
)

It appears to work, but looks quite ugly, where some of the leaders go past the geometry centroid as follows:

Example_1

And others fail to reach it:

Example_2

Why does this occur and how can I fix it?

Taras
  • 32,823
  • 4
  • 66
  • 137
user32882
  • 3,514
  • 2
  • 31
  • 67

1 Answers1

3

The centroid of the geometry is basically the centerpoint of the geometry's bounding box. Thus, it can be situated outside of the geometry, especially when it comes to lines. Only for straight lines the centerpoint will be "inside" the geometry.

You could use the middle of the line instead.

Erik
  • 16,269
  • 1
  • 24
  • 43