Create Buffer Size from an Attribute Value

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2022.2

Introduction

In FME, a buffer can be created around a geometry using a width extracted from an attribute. Using an attribute value as the buffer size can be useful in scenarios where the size of the geometry needs to be variable or dynamic, such as pipe diameter, road width, catchment areas, zoning, and more.

The key transformer for creating buffers is the Bufferer, which works with point, line, and polygon features. The Bufferer can take a constant value or an attribute as the buffer size. To create an expression based on an attribute value, use the ExpressionEvaluator transformer.

 

Step-by-Step Instructions

We will use GPS points and vehicle speed data to create geometry demonstrating traffic flow and congestion points. We will create buffer polygons using vehicle speed as the dynamic attribute value.

1. Open FME Workbench
Open FME Workbench and create a new workspace.

2. Add a CSV Reader
First, we will read in the GPS points, which are in CSV format.
Click Add Reader and set the following parameters:

  • Format: CSV (Comma Separated Value)
  • Dataset: <Path to tutorial download>/journey.csv

01 csv reader.png
Click Parameters to preview the data. Note how in the “Attributes” section at the bottom, the CSV reader automatically labels the lat/long fields as x and y coordinates—in other words, it automatically generates points from the data. For more information, see Converting from CSV to spatial features.

01 csv reader parameters.png


Click OK to add the reader to the workspace.
When viewed in Visual Preview, the source GPS points look like this:



3. Add a Reprojector Transformer
Next, we will reproject the coordinate system from its current one, LL84, to British National Grid (EPSG:27700).

Add a Reprojector transformer and connect it after the reader feature type.

02 reprojector workspace.png

Open the parameters and set the following:

  • Source Coordinate System: LL84
  • Destination Coordinate System: EPSG:27700


02 reprojector.png

Click OK.

4. Add an ExpressionEvaluator Transformer
Now we will create an attribute named “_buffer” to store the buffer size.

Add an ExpressionEvaluator after the Reprojector.

03 expressionevaluator.png

Open the parameters and set the following:

  • Result: _buffer
  • Arithmetic Expression: @Value(Speed)*4


03 expressionevaluator params.png

Click OK.

5. Add a Bufferer Transformer
Add a Bufferer transformer after the ExpressionEvaluator.

04 bufferer.png

Open the parameters. Use the down arrow to set “Buffer Distance” to the new attribute, _buffer.

04 bufferer params.png

Leave the other parameters as their defaults. Click OK.

If you run the workspace up to this point and inspect the results of the Bufferer in Visual Preview, you’ll see that each GPS point has been given a buffer, creating a sequence of individual polygons. When we zoom in, it looks like this:
 



Next, we want to convert this sequence of polygons into a single polygon.

6. Add a Dissolver Transformer
Add a Dissolver transformer after the Bufferer to dissolve the polygons into one. Leave the parameters as their defaults.

05 dissolver.png

Note: The Bufferer transformer has a Group By option that can be used to dissolve buffers together. This option is helpful if the size of the buffer is constant. However, in this scenario, since the size of the buffer is not equal (variable size), this option will not work.

7. Add an Inspector
Connect an Inspector after the Dissolver’s Area output port. This will send the output to Visual Preview instead of writing it to an output format.

The final workspace looks like this:

06 inspector.png

8. Run Workspace and Visualize Output
Click Run Workspace. Inspect the output in Visual Preview. Note how the size of the polygon changes depending on the speed values at each point along the line. The narrow areas indicate slower speeds, i.e. congested areas or bottlenecks.
 



The below image shows the buffered polygon over top of the source dataset. Bottlenecks with lower speed values are outlined in red:
 



You have successfully created a workspace that uses the source data’s speed attribute to create a buffer around the geometry.
 

Additional Resources

Other useful transformers for creating variable-width buffers include:

  • Chopper – for chopping lines into individual points
  • Generalizer – can be used before buffering complex objects to reduce the number of points or smooth the geometry
  • LineJoiner and Snapper – can be a helpful sequence of transformers when buffering line features

 

Data Attribution

The data used in this example originates from Open Street Map and is available under the Open Database License. © OpenStreetMap contributors

Map tiles by Stamen Design, under CC-BY-3.0. Data by OpenStreetMap, under CC-BY-SA.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.