Creating a Polygon from Line Segments

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2022.0

Introduction

Creating polygons in FME can be accomplished by using a polyline or line features, such as a street network, and the AreaBuilder transformer. Since a street network is a set of topologically connected linework, the AreaBuilder is able to create polygon features from lines that are connected by vertices/endpoints and form shapes (i.e. a closed polygon). However, areas can also be created from disconnected line features using the LineCloser.

 

Step-by-step Instructions

In this tutorial, you will create polygons for city blocks from a street network that consists of Arterial, Residential, Private, and Non-city streets using the AreaBuilder.

Source
The source data is an Esri Shapefile containing all of the roads in the City of Vancouver. 
RoadsSource.png

 

1. Create a New Workspace
Open FME Workbench and create a blank workspace. 
NewWorkspace.png
 
2. Add an Esri Shapefile Reader
Add an Esri Shapefile reader to the canvas by clicking on the Reader button on the top menu bar or by going to Readers > Add Reader. In the Add Reader dialog, select Esri Shapefile as the Format, then for Dataset browse to the Roads.shp dataset which is available for download from the Files section on this article. Then click OK to finish adding the reader.
Reader.png
 
3. Create Polygons
Click on the Roads reader feature type to select it.  Then add an AreaBuilder transformer to the canvas by typing “AreaBuilder” to bring up the list of FME Transformers in the Quick Add Search. Select the AreaBuilder from the list of Transformers by double-clicking or by using the arrow keys and the Enter key to add it. 
QuickAdd.png
Connection.png

 
Double-click on the AreaBuilder to open the parameters. In the parameters, de-select Create Donuts. Next, expand the Snapping Pre-Processing section, change the Snapping Type to End Point Snapping, and set the Snapping Tolerance to 8. 
AreaBuilder.png
 
Note: snapping tolerance is measured in map units which in this case is meters.
 
4. Run Workspace
Connect an Inspector transformer to the Area output port on the AreaBuilder. 
Workspace.png
 
Run the workspace by clicking on the Run button on the top toolbar, or by using Run > Run Workspace on the top menu bar. 
Run.png
 
After running the workspace, the output will be opened in Visual Preview. Click on a feature and note that the entire block is a single feature, compared to the input dataset where the block was multiple line segments. 
Input.png
Output.png

 

Data Attribution

Data used in this tutorial originates from open 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.