Skip to main content
Question

Remove lines where the lenght is longer outside than inside polygon

  • September 22, 2020
  • 2 replies
  • 35 views

souryana
Contributor
Forum|alt.badge.img+11

 

I have a layer with polylines that intersect with polygons where I use the method intersection (Spatial filter). I want to remove those lines where bigger parts of the line is outside than inside a polygon. How should I proceed?

BR

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

takashi
Celebrity
  • September 22, 2020

Does a polyline always intersect just a single polygon like the left figure? Or can a polyline intersect two or more polygons like the right figure?

intersections


ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • September 22, 2020

I'd follow this process

  • Calculate the length of the lines
  • Store the geometry as an attribute
  • Clip the lines with the polygons
  • Calculate the length of the clipped lines inside the polygon
  • Test if that length is greater than 50%
  • Recreate the original geometry from the attribute stored in step 2

Capture