Is there an expression or tool that allows the user to remove the longest segments of a polygon? The end result would be two end segments (lines)

enter image description here

  • Are you sure the curve is not made of dozens of very small segments?
    – JGH
    May 25 at 18:32
  • Good point - the longer segments of the polygon could be composed of many smaller segments, but this would need to be considered as well. I have looked into exploding the polygon and single part to multi part with no luck.
    – Anthony
    May 25 at 19:44
  • will it always only have 4 sides?
    – bloigge
    May 26 at 6:28
  • Pick a point at random start traversing, calculate bearing change with last 2 points, if bearing change is within threshold consider it to be one of the corners and start adding new points falling within same threshold of bearing change add to same linestring. If not create a new linestring. As a result you will get 4 linestrings. Calculate the length of linstring and separate out 2 longer sides of polygon vs 2 shorter. I can implement this using python and shapely if you want. Don't know about qgis.
    – Abhilshit
    May 26 at 13:59


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.