Creating a Polygon from Line Segments

Liz Sanderson
Liz Sanderson
  • Updated

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 can create polygon features from lines connected by vertices/endpoints that form shapes (i.e., closed polygons). However, areas can also be created from disconnected line features using the LineCloser.

Source Data

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

RoadsSource.png

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.

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 of 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, deselect the Create Donuts option. Next, expand the Snapping Pre-Processing section, change the Snapping Type to End Point Snapping, and set the Snapping Tolerance to 8. 

Snapping tolerance is measured in map units, which in this case is meters.

AreaBuilder.png

4. Run Workspace

Connect an Inspector transformer to the Area output port on the AreaBuilder. 

Workspace.png

Run the workspace by clicking the Run button on the top toolbar, or by selecting Run > Run Workspace from 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, whereas in the input dataset, it was multiple line segments. 

Input.png

Output.png

Data Attribution

The data used here 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?

We're sorry to hear that.

Please tell us why.

As of January 14th, 2026, comments on knowledge base articles have been closed. To make sure questions don’t get missed and to enable more community support, we’ve moved discussions to the FME Community. If you have a question or a comment about this article, please create a new post or create a support ticket.