1

With make_line(centroid ($geometry), make_point("x","y")) you can draw a line between the label and the center of an polygon, like this:

enter image description here

Is there a way to draw a line just between the border/edge of the polygon and the label?

The polygons have a transparent fill, so cannot just be drawn over the line.


Yes, the polygons are separate from each other or located at the edges. Is there any possibility to change the ankerpoint from endpoint of the polygon to the nearest point between the edge/border of the polygon and the label?

So that i can adjust the Label all around the polygon with a connection line between label and polygon edge/border?

2
  • Are the circles connected or separate from each other?
    – ahmadhanb
    Commented Nov 14, 2017 at 11:18
  • Maybe with closest_point ? ... but i think u got to have an attribute in common linking the object and the label ....
    – Snaileater
    Commented Nov 14, 2017 at 11:31

1 Answer 1

3

If the polygons are separate from each other or located at the edges, then you can use the following expression in the Geometry Generator:

difference(make_line(end_point($geometry),make_point("Label_x","Label_y"),$geometry), buffer(make_point("Label_x","Label_y"),0.001))

and it will give the following result:

enter image description here

But, it will not work if the polygons are located in the center among other polygons as in the following example:

enter image description here

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.