Generating Polygon Differences with the Clipper Transformer

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

Introduction

A common GIS operation is to overlay two (or more) polygons to subtract the area of one polygon from another.
For example, you might have a polygon representing the outline of a town or city. You also have a dataset of polygons representing residential areas. By overlaying the two you can subtract one from the other to identify parts of the city that are not residential areas.
FME has several transformers that will overlay data, but to cut out parts of a polygon the best solution is the Clipper transformer. 
 

Video


This video was recorded using FME 2016. The concepts are still the same but the FME interface is different. 
 

Source Data

The source datasets for this example are a set of polygons representing parks (in MapInfo TAB format) and a set of polygons representing buildings (in AutoCAD DWG format). In the Visual Preview (or FME Data Inspector)  it looks like this:
SourceData.png
Map tiles by Stamen Design, under CC-BY-3.0. Data by OpenStreetMap, under CC-BY-SA.

A common task is to calculate the area of parks to assess what grounds maintenance needs to be carried out. Of course, this should not include the area occupied by buildings. This example builds a workspace to subtract building footprints from parks before measuring the area of those parks.
 

Step-By-Step Instructions

A completed workspace is available for both FME 2021.2 and FME 2022 in the Files section on this article. The Clipper was upgraded in FME 2022 and has new functionality not available in previous versions. If you are using an older version of FME, please refer to the 2021 workspace for terminology and parameters if the following steps are unclear. 
 

1. Add Autodesk AutoCAD DWG/DXF Reader
Open FME Workbench and start a new workspace. Add an Autodesk AutoCAD DWG/DXF reader to the canvas and browse to the BuildingFootprints.dwg dataset that is available in the Files section of this article. Then click OK.
DWGReader.png

In the Select Feature Types dialog, unselect 0, and then click OK. We are only interested in the BuildingFootprints layer. 
SelectFT.png

 
2. Add a MapInfo TAB (MITAB) Reader
Now we will read in the Parks dataset, which is a MapInfo TAB file. Add a MapInfo TAB (MITAB) reader to the canvas and browse to the Parks.tab dataset. 
MITABReader.png
 
3. Calculate Park Area
Next, we need to find out what the total area of each park is before we subtract the building area from the park. Add an AreaCalculator to the canvas and connect it to the Parks reader feature type. In the parameters, change the Output Area Name to TotalParkArea
ParkAreaCalc.png
 
4. Clip BuildingFootprint from Park
Using the Clipper, we will clip the Park with the BuildingFootprint. Add a Clipper to the canvas and connect the BuildingFootprint reader feature type to the Clipper input port, and the AreaCalculator Output port to the Candidate (Clippee) input port. 
ConnectClipper.png

In the Clipper parameters, confirm that Multiple Clippers is set to Yes. We need to ensure this is set to yes, as there might be several buildings contained within a single park. 
ClipperParams.png
 
5. Calculate the New Park Area
With the BuildingFootprints clipped from the Parks, we can now determine the new Park area with another AreaCalculator. Add an AreaCalculator to the canvas and connect it to the Output output port on the Clipper. The Outside port will be the parts of the park features that fall outside of a BuildingFootprint. 
AreaCalc2.png

In the AreaCalculator_2 parameters, change the Output Attribute Name to ParkLandArea, then click OK. 
ParkLandArea.png
 
6. Inspect Output
Add an Inspector transformer to the canvas and connect it to the AreaCalculator_2 output port. Run the workspace and view the output in Visual Preview. 
In Visual Preview, you will see that each park will have had the building footprints cut from it, and will possess an area measurement both with and without the buildings. 
VPOutput.png
Map tiles by Stamen Design, under CC-BY-3.0. Data by OpenStreetMap, under CC-BY-SA.

To determine if a park had a building cut out or not, check for an attribute called _clipped. If that attribute is set to no then the before and after area should be the same.
 

Data Attribution 

The data used here originates from data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.