Calculating Area, Perimeter, and Lengths

Sydney Dombowsky
Sydney Dombowsky
  • Updated

Introduction

Area, perimeter, and length can be calculated for features using transformers such as the AreaCalculator and LengthCalculator in FME. In this tutorial, you will learn how to calculate the area of polygon features, the perimeter of polygon features, and the length of line features.

The workspace and source data, which is a polygon shapefile representing parks and a line shapefile representing bike paths, can be downloaded from the Files section.
 

Step-by-Step Instructions

Exercise 1: Calculating the Area of Polygon Features 

In this exercise, we will learn how to calculate the area of park polygons using the AreaCalculator. Determining the area of each park will help us understand the distribution of green space throughout the city. 

To learn more about calculating area, see the Area Measurements with the AreaCalculator article.

 

AreaWorkspace

1. Start FME Workbench and Add Parks Data

Start FME Workbench and click on New to open a blank workspace.

To add the parks data, click the Reader button in the Toolbar. In the Add Reader dialog window, enter the following:

  • Format: Esri Shapefile
  • Dataset: /Parks.shp
    • Click on the ellipsis (blank document icon for macOS) and browse to the dataset

Then click OK.

ReaderShapefile


2. Add a Writer to the Workspace

We want the final dataset to be in the same format as the input, so we will add an Esri Shapefile writer feature type for the output data to be written to.

Click Writer in the Toolbar and set the following parameters:

  • Format: Esri Shapefile
  • Dataset: /Output
    • Set the destination folder for your output data

Click OK. A Feature Type dialog box will pop up. Set the name for the output shapefile, then click OK:

  • Shapefile Name: ParksArea

WriterShapefile
 

 

3. Calculate Area with AreaCalculator

To calculate the area of each park in the dataset, we will use an AreaCalculator transformer. Type AreaCalculator in the canvas and press Enter on your keyboard to add the transformer to your workspace.

Connect the Parks reader feature type to the AreaCalculator Input port. Connect the AreaCalculator Output port to the ParksArea writer feature type.

AreaCalculator

The Q__area attribute listed under the ParksArea writer is a placeholder and will be replaced once we set an output attribute name within AreaCalculator.

Double-click the AreaCalculator transformer to open the dialog, and set the following parameters:

  • Output Attribute Name:
    • Area: park_area

AreaCalculatorParams

This will store the calculated area values in a new attribute (column) called park_area.
 

4. Round Area Values with AttributeRounder

If we ran this workspace as is, the calculated areas would not be rounded. In this scenario, we want the area of each park to the nearest meter so we will use an AttributeRounder transformer to round the area values.

Select the connection line between the AreaCalculator and the ParksArea writer. Type AttributeRounder and press Enter on your keyboard to connect the transformer to your workspace:

AttributeRounder

Open the parameters dialog and enter:

  • Attributes to Round: park_area
    • Click the ellipsis to select attributes
  • Decimal Places: 0

AttributeRounderParams


5. Run the Workspace

Run the workspace by clicking on the green Run button on the top toolbar:

Run

You can view the output dataset to see the newly added park_area attribute by selecting the ParksArea writer feature type to open the popup menu and clicking on the View Writen Data button:

ViewWrittenData

AreaResult

 

Exercise 2: Calculating the Perimeter of Polygon Features 

In this exercise, we will learn how to calculate the perimeter of park polygons using the LengthCalculator. 

The steps in Exercise 2 are similar to those in Exercise 1. Refer back to Exercise 1 for more detailed step instructions.

PerimeterWorkspace
 

1. Start FME Workbench and Add Parks Data

Create a new workspace and add the parks data with a Reader. Enter the following in the Add Reader dialog:

  • Format: Esri Shapefile
  • Dataset: /Parks.shp


2. Add a Writer to the Workspace

Click Writer in the Toolbar and set the following parameters:

  • Format: Esri Shapefile
  • Dataset: /Output

Click OK, then set the name for the output shapefile:

  • Shapefile Name: ParksPerimeter

WriterShapefilePerimeter

3. Calculate Perimeter with LengthCalculator

To calculate the perimeter of each park in the dataset, we will use the LengthCalculator. Add a LengthCalculator transformer to the canvas and connect the Input port to the Parks reader and the Output port to the ParksPerimeter writer.

LengthCalculator

Double-click the LengthCalculator transformer to open the dialog, and set the following parameters to store the calculated perimeter values in a new attribute:

  • Output Attribute Name:
    • Area: park_perim

LengthCalculatorParam

 

4. Round Values with AttributeRounder

Like the park area values, we want the perimeter of each park to the nearest meter so we will use an AttributeRounder transformer to round the values.

Add an AttributeRounder in between the LengthCalculator and ParksPerimeter writer:

AttributeRounderPerimeter

Open the parameters dialog and enter:

  • Attributes to Round: park_perim
  • Decimal Places: 0

AttributeRounderParams


5. Run the Workspace

Run the workspace and view the output dataset in Data Preview using the View Written Data button. You will notice that the park_perim values are displayed as whole numbers.


PerimeterResult

Exercise 3: Calculating Length of a Line 

In this exercise, you will learn how to calculate the length of bike paths using the LengthCalculator. To learn more about calculating length, see the Distance Measurements with the LengthCalculator article.

The steps in Exercise 3 are similar to those in Exercise 1 and 2. Refer back for more detailed step instructions.

LengthWorkspace


1. Start FME Workbench and Add Bike Path Data

Create a new workspace and add the bike path data with a Reader. Enter the following in the Add Reader dialog:

  • Format: Esri Shapefile
  • Dataset: /BikePaths.shp

 

2. Add a Writer to the Workspace

Click Writer in the Toolbar and set the following parameters:

  • Format: Esri Shapefile
  • Dataset: /Output

Click OK, then set the name for the output shapefile:

  • Shapefile Name: BikePathsLength

WriterShapefileLength

3. Calculate Length with LengthCalculator

To calculate the length of each bike path in the dataset, we will use the LengthCalculator. Add a LengthCalculator transformer to the canvas and connect the Input port to the BikePaths reader and the Output port to the BikePathsLength writer.

LengthCalculator

Double-click the LengthCalculator transformer to open the dialog, and set the following parameters to store the calculated bike path length values in a new attribute:

  • Output Attribute Name:
    • Area: path_len

LengthCalculatorParam

 

4. Round Values with AttributeRounder

Like the park area and perimeter values, we want the length of each bike path to the nearest meter so we will use an AttributeRounder transformer to round the values.

Add an AttributeRounder in between the LengthCalculator and BikePathsLength writer:

AttributeRounder

Open the parameters dialog and enter:

  • Attributes to Round: path_len
  • Decimal Places: 0

AttributeRounderParam


5. Run the Workspace

Run the workspace and view the output dataset in Data Preview using the View Written Data button. You will notice that the path_len values are displayed as whole numbers:


LengthResult.

 

Additional Resources

AreaCalculator Transformer Documentation

LengthCalculator Transformer Documentation

AttributeRounder Transformer Documentation

Area Measurements with the AreaCalculator Article

Distance Measurements with the LengthCalculator Article

 

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?

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.