Introduction
The Clipper performs a geometric clipping operation (sometimes called a cookie-cutter). Most geometry types can be clipped by an area, and some may also be clipped by a solid. The following examples demonstrate the Multiple Clippers, Clippers Arrive First, and Overlapping Clipper parameters. See the Additional Resources at the end of the article for more Clipper tutorials.
The Clipper takes a number of clip boundaries (Clipper input port) and a number of features to be clipped. Then the output is split into four output types:
- Inside: All Candidate/Clippee features that are entirely inside a Clipper feature
- Outside: All Candidate/Clippee features that are entirely outside all Clipper features
- Remnants: Outputs features that are zero-width or nearly zero-width, that have no area, such as a zero-width spike.
- <Rejected>: Controlled by the “Invalid Parts Handling” parameter. This parameter controls the behavior of rejected features, such as aggregate and multi geometries that contain features that are invalid for clipping (such as null geometries). These geometries without a spatial location cannot be classified as inside or outside. Use this parameter to decide whether to reject only the invalid parts or the entire feature.
Examples
There are many parameters in Clipper, but only a few are commonly used. The following examples will demonstrate these commonly used parameters. For more details on these and other parameters, please see the Clipper documentation.
Multiple Clippers/Clippers Arrive First
Download ClippersFirst.fmwt for a sample workspace.
When running a workspace, if you can guarantee that the data entering the Clipper input port on the Clipper transformer arrives first, you will see significant performance gains. This is especially true for FME 2022.
To ensure that your data arrives first, the order in which it arrives at the Clipper input port can be controlled. Firstly, you can modify the order in which the data is read by reordering the readers in the Navigator pane or by controlling Run-Time Order for transformers with no input port, such as a Creator or SQLCreator, or any custom transformer. Secondly, you can also control the Run-Time Order when a transformer has multiple outputs coming from the same output port.
Once you have confirmed that the data will be arriving with the clippers first to the Clipper transformer, this parameter needs to be enabled. In the Clipper parameters, set Clippers Arrive First to Yes. Additionally, if you have multiple Clippers coming into the Clipper, the Multiple Clippers parameter must be set to Yes.
If either of these parameters is used and the assumption is not true, Clipper features will be rejected with the rejection code ‘EXTRA_CLIPPER_FEATURE’.
In the example workspace, the Cloner is used to create over a million cell signal points, to be clipped against the neighborhoods in Vancouver. With Clippers First set to No, the workspace takes over 5+ minutes to run. With Clippers First set to Yes (Advanced), the workspace takes only 3 minutes. Run the workspace for yourself to see the performance differences (actual times may vary due to computer hardware limitations).
Overlapping Clippers
Download OverlappingClippers.fmwt for a sample workspace.
When using multiple clippers, there are three different options to tell FME how to clip the Candidate when the Clippers overlap.
By default, the Clipper is set to Clip Only Outside Remainders, which means the first clipper to arrive will clip its portion; then the second clipper will clip the remainder.
The other two options, Clip Original Candidates and Clip Interm Results, will clip the candidate, then clip the original again, as well as output the overlap when Interm Results is set.
In the example workspace, there are two types of promotions a company plans to send out: a flyer with a coupon and one without. They have two different boundaries for these promotions based on previous campaigns. Using the Overlapping Clippers parameter, let’s determine which method would be the best. In addition, we will generate a List From Overlapping clips, with the Clipper List Name set to Strategies.
Clipping Only Outside Remainders
The Clipping Only Outside Remainders option clips the flyer with the coupon first, then clips the remainders. Where the clippers overlapped, the customer will only get the flyer with the coupon.
Clip Original Candidates
For the Clip Original Candidates option, the overlapping area is clipped twice. This means the customer would get the same flyer with a coupon twice.
Clip Interim Results
For the Clip Interim Results option, the overlapping section contains flyers for both promotions, as shown because the list was enabled. This means the customer would get both the flyers.
The best clipping option to ensure all customers receive only a single flyer would be Clip Only Outside Remainders. If we had different promotion options, such as an email and a newspaper, Clip Interim Results would be a good option.
Additional Resources
Clipper documentation
Clip, Clip, Hooray! Get Just the Data You Need with Clipping webinar
Generating Polygon Differences with the Clipper Transformer
How to Dissolve Geometry Solids
How to Clip TIN Surfaces