I have quite a hard problem to solve here and I don't know if its even possible with the geometry functions in QGIS. I have a line geometry with equidistant vertices, that is, same length segments. Based on a treshhold angle of a segment and its subsequent segment, I'd like to generate new offset line segments - if the angle is > 10 but < 180, I would have all the 'hard' right turns and would like the newly created line segments for these two segments to be offset to the left, if the angle is > 180 and < 350 then I'd have the 'hard' left turns and would like the newly created segments offset to the right side. That is, the segments with 'hard turns' would have a offset line segment at the outer side of the original two line segments. Like in the example picture below! The math for the angle, I think, are in this example: https://stackoverflow.com/questions/4294638/how-to-calculate-angle-between-two-direction-vectors-that-form-a-closed-open-sha

Exemple Picture with line segments at turning lines, offset left or right, depending on negative or positve angle to last line segment

  • Can I understand the angle of a segment is measured from the south, clock-wise? – Kazuhito Aug 11 '18 at 19:50
  • It's always angle the of two subsequent line segments... – Kay Aug 11 '18 at 20:28
  • 1
    If only the angles between segments (not azimuth) matters, Segmentize by Maximum Angle (quite recent tool) may be of help to extract those acute-angles out. Then it can be used for geometry generator to create offset lines. – Kazuhito Aug 13 '18 at 9:15
  • Thx for the hint @Kazuhito - I'll look into that (after updating my QGIS;)! – Kay Aug 13 '18 at 19:17

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.