I have a polygon layer which I need to label on the opposite ends of a line and still maintain the labels parallel to this segment of a polygon. The labels need to be offset slightly from the end point of the line segment. In order to achieve this, I have derived lines that make up a polygon and now am struggling to achieve the desired labelling effect. I have used function $x_at( -1). How can I label it to be identical to

enter image description here

where I have the lines making up a polygon as

enter image description here

  • 1
    If you are starting from lines, you may use something like x(line_interpolate_point($geometry,0.7*$length)) for the X coordinate and y(line_interpolate_point($geometry,0.7*$length)) for the Y coordinate. It essentially places your label at a specific percentage of the total length of the line feature (in this example, 70%). – mgri Jul 18 '17 at 20:46
  • Once you start using data defined setting how then do you set the placement to be aligned parallel? – kartoza-geek Jul 19 '17 at 6:42
  • Did the trick work for you? If yes, I could add an answer (starting from line features) – mgri Jul 19 '17 at 7:52
  • in terms of placing the labels at opposite ends it works, But they not parallel to the line segment of the polygon – kartoza-geek Jul 19 '17 at 9:02
  • For parallelism use: -angle_at_vertex ($ geometry, 0) +90 – pigreco Jul 19 '17 at 9:58

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.