FME Version
Files
Introduction
In this exercise, you will learn how to simplify linear features, by removing unnecessary coordinates using the Generalizer Transformer in FME.
Step-by-step Instructions
In this scenario, you want to simplify a bike path network to show the general path rather than every single turn. We will use the Douglas (Generalize) algorithm to reduce the density of coordinates by removing vertices, thus simplifying the line.
Source
The source dataset is an Esri Shapefile containing bike paths in the City of Vancouver.
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 BikePaths.shp dataset which is available for download from the Files section on this article. Then click OK to finish adding the reader.
3. Generalize Lines
Click on the BikePaths reader feature type to select it. Then add a Generalizer transformer to the canvas by typing “Generalizer” to bring up the list of FME Transformers in the Quick Add Search. Select the Generalizer from the list of Transformers by double-clicking or by using the arrow keys and the Enter key to add it.
Double-click on the Generalizer to open the parameters. In the parameters, confirm that the Algorithm is set to Douglas (Generalize), then set the Generalization Tolerance to 10.
We used the default Douglas algorithm because it removes vertices that cause a deviation of less than the Generalization Tolerance, but the location of the remaining vertices is not altered. This algorithm is good at reducing the number of points in a line; however, it is not very good at preserving the shape or the spatial relationship of the line relative to other entities. For more technical details, see the Generalizer Documentation.
4. Run Workspace
Connect an Inspector transformer to the Output port on the Generalizer.
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 be opened in Visual Preview. Viewing both of the datasets together (by adding a second Inspector to the reader feature type), you can see that the blue/teal line is the generalized line with fewer points than the original red line.
Another transformer to consider for thinning or smoothing data is the SherbendGeneralizer. This transformer is particularly useful for contour thinning, and is capable of respecting the spatial relationships among features. In other words, it ensures thinned lines do not cross one another and also honors spot heights or the equivalent.
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.
Comments
0 comments
Please sign in to leave a comment.