4

I have a layer with lines, and I am trying to rotate some of their labels that are displayed at 270º to get them at 90º like the rest, but the expression is doing nothing. Even fixing the expression to a random value, like 45º, would not affect any label. I tried generating a field containing the desired azimuth and then linking the field to the rotation, like shown in another question, but got no changes. The expression I was trying to use is this one:

with_variable('azi',  
  degrees(azimuth(start_point($geometry), end_point($geometry))),  
  if(@azi-180>-1 AND @azi-180<1,360,@azi)  
)

This is what I want to avoid
Placement in that layer is set to parallel, left and right of line with line orientation dependent position enabled. The layer has been forced right hand rule. I need to know why data defined rotation is not working for me or what im doing wrong.

6
  • Please provide a screenshot showing the result of the current settings. How did you hand over the rotation value to the label?
    – Erik
    Mar 17 at 15:44
  • Tryed to hand it with an integer number, a decimal and text in the expression. The field I created to try it was set to be real number, 10 digits with 5 decimal places
    – Opazo
    Mar 18 at 12:33
  • I had a quick look at this yesterday and it seems the rotation only works when you also supply the X and Y position of the label (or define it using the geometry generator). I may be wrong, however.
    – Matt
    Mar 18 at 16:21
  • You may indeed be correct... The only way I managed to rotate one was manually, and had to move the label before it rotated... It would suck tho. Im trying that on monday at the office, will keep you posted
    – Opazo
    Mar 19 at 18:49
  • 1
    @kowalski I found a way around, you need to fill the fields with X and Y coordinates first, for it to take the angle. But it was too much work for the benefit, so we ended up leaving it as it was.
    – Opazo
    Jun 3 at 15:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.