Building a Topological Network from a Road Dataset | Using the TopologyBuilder

Kailin Opaleychuk
Kailin Opaleychuk
  • Updated

FME Version

  • FME 2021.0


Network topology is made from a network of nodes and lines that is maintained throughout an area. The vitality of topological networks relies on consistent and connective geometry. Topology is often applied to transportation datasets, to ensure certain logic is being followed (i.e. for addressing over or underpasses on a highway). 

In this scenario, we are fronted with a centrelinesroad.gdb (accessible here) of Surrey, BC. In order to create an accurate topological network, we will have to do some geometry handling. When you are working with advanced topologies, you may choose to exercise validation rules to produce a more sophisticated network. 

What is required before you can build a topological network?

  1. Lines must touch at an END vertex (snapped).
  2. Lines must be split at junctions. (i.e. junctions must be at the end of a line, not at an interior vertex).
  3. No complex edges present (FME doesn't support these).

To learn how to identify bad topology, please reference the examples in this tutorial: Data QA: Identifying Bad Topology in Linear Networks


Step-by-step Instructions

Download to follow along with this exercise from home. 

1. Start Workbench
Open Workbench and start a new workspace.

2. Add an Esri Geodatabase (File Geodb Open API) Reader
Leave all parameters as default. Click OK to add the reader to the canvas.


3. Add a Deaggregator
Use the transformer gallery or another method to add a Deaggregator. Leave all parameters as default. Connect it to the Esri Geodatabase reader. By deaggregating, we break multi-part lines into separate features each line feature for later operations.


4. Add a PathSplitter
Now we are going to create line segments by adding a PathSplitter. Leave all parameters as default. Connect the output port from the Deaggregator. 

Paths are sometimes used for complex edges. These are continuous edges that have path segments where other lines join at a junction (FME doesn't support complex edges). 


5. Run your workspace
Let's take a look at our transformation so far. Run your workspace with feature caching enabled and use the Visual Preview window to inspect the road data. As of now, we have been segmenting features so we can apply topology.

As we inspect the data, we notice some features are not aligned (i.e. vertices at a junction must be at exactly the same point/location), please reference the bottom left image. The right image shows the expected alignment. So, how do we fix this? 

We could also choose to view our data in the FME Data Inspector, which has some additional functionality such as the measure tool, opposed to the Visual Preview window (user preference). You can access FME Data Inspector through the start menu. Once initiated, select File > Open Dataset to view your file.


6. Add a Snapper
Add a Snapper to your workflow. We are going to use Segment Snapping. In order to find the appropriate value for Snapping Distance, it's handy to leverage the measure tool in the FME Data Inspector. Set the Snapping Distance to 5.0 and Tolerance to Automatic.


7. Create a Workspace Junction
Junctions are a useful tool for managing connections as you build and organize a workspace. To make a Junction, right-click on the Snapped port on the Snapper, and select Insert Junction. This way we can pass both snapped and unsnapped segments through our workspace. 


8. Add Two CoordinateExtractors
We are going to use two CoordinateExtractors to get the first and last coordinates of each line feature. Add two CoordinateExtractors to the canvas and connect them both to the Junction.


Double-click on the first CoordinateExtractor to open the parameters. Here we are going to find the first coordinate of each road. Set the Mode to Specify Coordinate. Expand the Specify Coordinates section of the transformer. Set Coordinate Index to 0, X Attribute to _x0, and Y Attribute to _y0. Click OK to confirm.


Now, we are going to repeat this process with CoordinateExtractor_2 to find the last coordinate of each road. However, we need to specify different coordinate values. Set Coordinate Index to -1, X Attribute to _x1, and Y Attribute to _y1. Click OK to confirm.


9. Add Two VertexCreators
Add two VertexCreators to the canvas. We need to properly node the network without introducing new vertices (or end nodes). This is extremely important in road networks, to avoid representing highway overpasses or bridges as intersections (for example). To do this, we can use the coordinates extracted in the last step. Each CoordinateExtractor will connect to an individual VertexCreator, like below:


Double-click on the first VertexCreator to open the parameters. Set Mode to Replace with Point, X Value to _x0, and Y value to _y0.


When you are done, repeat this process with VertexCreator_2 with the following values, set Mode to Replace with Point, X Value to _x1, and Y Value to _y1.


10. Add a PointOnLineOverlayer
In this step, we are going to use a PointOnLineOverlayer to create road junctions and split lines at the junctions. Add a PointOnLineOverlayer to the canvas. Connect both VertexCreator outputs to the Point input port on the PointOnLineOverlayer. Next, connect the Junction (after Snapper) to the Line input port. Open the parameters, apply a Point Tolerance of 0.1 and leave all other parameters as default.



11. Build the Topology
Add a TopologyBuilder. Connect the Line output port to the TopologyBuilder. Leave all parameters as default.

*Note: List generation is optional. If you do not wish to generate lists for Edges or Nodes, leave the boxes unchecked.


12. Add an Esri Geodatabase (File Geodb Open API) Writer
Finally, let's write the results. Add an Esri Geodatabase (File Geodb Open API) writer. Select a file destination for your dataset. Set Coord. System to LL84. Open the parameters, and change Overwrite Existing Geodatabase to Yes. Leave the default parameters. Connect the Edge output port from the TopologyBuilder to the Esri Geodatabase writer feature type. Click OK. Run your workspace.


You have now created a topological network for road centerlines in Surrey, BC. The final workspace should look similar to below: 


Use FME Data Inspector or the Visual Preview Window to inspect your results. 


Data Attribution

The data used here originates from data made available by the City of Surrey, British Columbia. It contains information licensed under the Open Government License - Surrey. 


Was this article helpful?



Please sign in to leave a comment.