4

I have straight lines in a metric CRS, connecting two points. So each line has exactly two vertices. I want to display these lines as curved arrows with curved labels above these arrows. QGIS version is 3.22.

To get the curved arrow, I am using geometry generator with a curved arrow on top of it. As expression I am using:

make_line(start_point($geometry), translate(centroid($geometry),length($geometry)/6,length($geometry)/6),end_point($geometry))

enter image description here

But since this curved arrow is constructed via geometry generator, the label is still displayed on top of the actual line:

enter image description here

Is there a way to define a rule for the label to follow the path from the curved arrow?

Note, that the line from geometry generator is actually not curved as shown below. So following this path would not be enough.

enter image description here

I would really like to avoid creating new layers, but if there is absolutely no way to define a rule for the label to follow the arrow, I could also live with a solution that modifies the actual geometry to make smooth curves via PostGIS.

1 Answer 1

6

A quite ok solution, but not perfect:

Use this expression for the symbology via geometry generator as well as for the label via geometry generator:

smooth(make_line(start_point($geometry),project(centroid($geometry),length($geometry)/6,radians(line_interpolate_angle($geometry,length($geometry)/2)+90)),end_point($geometry)),10)

Note the smooth() function. Play around with the number of iterations, to find a low number looking good.

enter image description here

enter image description here

enter image description here

Resulting in a little offset:

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.