Skip to main content
Question

Cut the lines and select only inside the polygon

  • November 18, 2015
  • 4 replies
  • 237 views

Forum|alt.badge.img
Hi,

 

 

I want to cut the lines inside a polygon. I thought of using the Clipper transformer however it is very slow. any ideas how I can optimize it and make it faster.

 

 

see below:

 

been a few mins now and looks like it only finished 6 lines..leaving it running until I think of another way to do it.

 

4 replies

takashi
Evangelist
  • November 18, 2015
Hi,

 

 

This may improve the performance.

 

  1. In the Navigator window, make sure that the Clipper features (polygons) will be read first. If the reader for the Clippers was not at the top of the tree, move it to the top.
  2. Set "Clippers First" to the "Clipper Type" parameter of the Clipper transformer.
Takashi

mark2atsafe
Safer
Forum|alt.badge.img+45
  • Safer
  • November 18, 2015
I think Takashi's answer is the one that is going to work for you. But another possibility would be to maybe pre-process the data using a simpler method, in order to drop anything that is nowhere close to a match.

 

 

For example, use a BoundingBoxAccumulator on the polygons, then use that bounding box as the filter in a SpatialFilter to find what lines are completely outside of it. Those lines can be discarded, as if they are completely outside the bounding box, they are never going to be touched by the Clipper.

 

 

Depending on how many features there are, it could save the Clipper a lot of work.

 

 

I don't say for sure this would be faster, and if this is a one-off project it might not be worth bothering with, but I've had some success with that technique in the past (outside of FME) so if this is a recurring process it would be worth experimenting.

 


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • November 18, 2015
mark2atsafe wrote:
I think Takashi's answer is the one that is going to work for you. But another possibility would be to maybe pre-process the data using a simpler method, in order to drop anything that is nowhere close to a match.

 

 

For example, use a BoundingBoxAccumulator on the polygons, then use that bounding box as the filter in a SpatialFilter to find what lines are completely outside of it. Those lines can be discarded, as if they are completely outside the bounding box, they are never going to be touched by the Clipper.

 

 

Depending on how many features there are, it could save the Clipper a lot of work.

 

 

I don't say for sure this would be faster, and if this is a one-off project it might not be worth bothering with, but I've had some success with that technique in the past (outside of FME) so if this is a recurring process it would be worth experimenting.

 

I agree, when dealing with 20,000+ features there is usually a performance boost in pre-filtering the data. Less than that performance gain in the clipper is offset by the cost of the spatialFilter.


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • November 18, 2015
Yeah, i always try not to use clippers on sets with a large number of clippees....too sloow.

 

 

Depending on how many objects you have, i suggest a AreOnArea overlayer followed by a tester.

 

AreaonArea has as added advantage the possible use of parallel processing.

 

 

First make sure all objects have a unique id.

 

Use a (single) tiler on both inputs, then separate them using a tester on "fme_feature_type" (expose on readers). Then use a AreaOnArea overlayer and group by tile id's (for instance row_id and column_id).

 

Mind setting parallel processing on aggressive or higher...you will hog down your entire machine for the duration of the proces ( all cores at 100%..lol).

 

After this a tester to test for overlaps >1 and fme_feature_type = clipperobjectnames.

 

 

 

Even though the tiling takes a bit o' time, the total proces will be fast.

 

 

 

Try it out.

 

 

 

 

 


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