Generate Contour Data from Points

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2022.0


In this tutorial, you will learn how to create contour lines using the ContourGenerator and a point dataset. The ContourGenerator in FME constructs a Delaunay triangulation based on the input 3D point features which are then used to generate contour lines.


Step-by-step Instructions

In this scenario, you will create contour lines from an elevation point dataset because you want to create a 50m contour dataset for later use.

The source dataset is an Esri Shapefile containing points with elevation data. 

1. Create a New Workspace
Open FME Workbench and create a blank workspace. 
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 ElevationPoints.shp dataset, which is available for download from the Files section on this article. Then click OK to finish adding the reader.
3. Create Contours
Click on the ElevationPoints reader feature type to select it.  Then add a ContourGenerator transformer to the canvas by typing “ContourGenerator” to bring up the list of FME Transformers in the Quick Add Search. Select the ContourGenerator from the list of Transformers by double-clicking or by using the arrow keys and the Enter key to add it. Ensure that the reader feature type is connected to the Points/Lines input port. 
Double-click on the ContourGenerator to open the parameters. In the parameters, set the Surface Tolerance to 100, then set the Output Contour Internal to 50. 
The ElevationPoints dataset we are working with contains approximately 1.4 million elevation points. Without filtering out points, the TIN would be very jagged and require more processing power. To reduce the number of points used to create the TIN, you need to specify a surface tolerance. A larger surface tolerance value will speed up the surface model construction and simplify the TIN - the larger the value, the more input points will be filtered out. To learn more about Surface Tolerance values, see the ContourGenerator Documentation. The Contour Interval is controlled in map units, which in this case would be meters. 
4. Combine Contour Line Segments
Next, we need to combine the contour line segments. Add a LineCombiner to the canvas and connect it to the Contours output port on the ContourGenerator. 
In the parameters, set Combine On Attributes to _elevation, then click OK. 
Note: For lines to be combined, they must meet at the exact same start/end point. Additionally, lines will remain broken at points where three or more lines converge. For more information, see the LineCombiner Documentation.
5. Run Workspace
Connect an Inspector transformer to the LineCombiner Combined output port. 
Run the workspace by clicking on the Run button on the top toolbar, or by using Run > Run Workspace on the top menu bar. 
After running the workspace, the output will contour lines 50 meters apart. 


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?



Please sign in to leave a comment.