Skip to main content
Question

How to filter lines with endpoints in polygons for clipping and keeping only line segments outside polygons?

  • September 5, 2018
  • 6 replies
  • 54 views

Forum|alt.badge.img

I have polylines and polygons as separate source data. A polyline that has an end in a polygon must be clipped with a polygon, leaving only part outside the polygon. At the same time, the lines thats intersects the polygons must remain unchanged.

6 replies

mygis
Supporter
Forum|alt.badge.img+13
  • Supporter
  • September 5, 2018

Hi @is you can use the clipper and choose the clipper and the lines outside the polygons will be output from the "Outside" port

 

For the lines that intersect the polygons you can use the LineOnAreaOverlayer transformer to know which ones touch the polygons. You could use the SpatialFilter as well, but I prefer the first one.


Forum|alt.badge.img
  • Author
  • September 5, 2018

I upload a picture - only red parts of polylines must be removed.


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • September 5, 2018
is wrote:

I upload a picture - only red parts of polylines must be removed.

Do you have the scenario where a polyline might start and end in different polygons and need to be clipped by both?

 

 


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • September 5, 2018

endpoints-in-polygons.fmwt

I would use a pattern matrix to determine which lines start/end within the polygon, then use that as a basis to group by in the clipper. If you have lines that start and end in different polygons, you then need to combine the clipped output so that only the portion of the line outside polygons is retained.


Forum|alt.badge.img
  • Author
  • September 5, 2018
ebygomm wrote:
Do you have the scenario where a polyline might start and end in different polygons and need to be clipped by both?

 

 

The situation when the line starts and ends in different polygons and must be cut at both ends is possible, but is not the basic condition, because in most cases the lines start outside the polygons. Thank you for advice, @egomm .

 


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • September 5, 2018
ebygomm wrote:

endpoints-in-polygons.fmwt

I would use a pattern matrix to determine which lines start/end within the polygon, then use that as a basis to group by in the clipper. If you have lines that start and end in different polygons, you then need to combine the clipped output so that only the portion of the line outside polygons is retained.

I think currently this wouldn't deal correctly with the scenario where a line starts and ends in the same polygon, you would need to update the matrix to 1010F0212 1010FF212 to include this.

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings