Remove Intersections From Line Networks

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2016.x
As of FME 2022.0, Python 2.7 has been deprecated and is no longer available within FME. Please see the Python 2.7 Deprecation article. This article has not yet been updated to use Python 3+, to continue with this article, please use FME 2020 or older.

 

Downloads

  • RemoveIntersections_2015.fmwt

 

Introduction

Occasionally it may be necessary to remove the intersections from a line network, possibly to optimize symbology for display. The LineJoiner transformer works well when the lines to be joined all share a unique identifier, but this is not always the case. In the case of a T intersection where all three lines share the same id, the LineJoiner will choose which two lines to join randomly.
http_download_1444329908385_6032.png

This example workspace will join the two lines with the minimum angle between them, producing the most esthetically pleasing result. Attributes on the source data can be used to override the angle result, if desired.

 

Workspace

1. Build a Network

http_download_1444329908536_6032.png

NetworkTopologyCalculator: The workspace uses a NetworkTopologyCalculator to establish network ids based on source data attributes - in this case StreetName. The attributes chosen for the Group By in this transformer will override the angle when determining which lines to join. i.e. if the lines don't have the same value for StreetName regardless of the angle then they aren't joined.

TopologyBuilder: The data is then sent to a TopologyBuilder transformer, which produces an arc/node topology where lines know which nodes connect them and nodes know the angle of the connecting lines. The TopologyBuilder is set to Group By the network id established by the previous transformer to maintain any attribute override.

AttributeExposer: Used to expose the network id (_network_id) so that it can used as an attribute in the workspace.

 

2. Process nodes to find lines that should join

http_download_1444329908912_6032.png

PythonCaller: The nodes are sent to a PythonCaller that uses an FMEObjects Python class to keep only the two links with the lowest divergence angle between them.

AttributeRenamer: The AttributeRenamers are used to renumber the arcs and links.

3. Cleanup line attributes and geometry
http_download_1444329909264_6032.png

StringConcatenator: Working with the line features join the network id to the arc id to give each line segment a full identifier. This will be used in a final FeatureMerger to merge back the node information.

GeometryRemover: Also pass a copy of the line features through a GeometryRemover to remove the geometry as these features are are going to be merged with the link data produced in Step 2 to identify arc numbers which can be joined.

AttributeKeeper: Keep only the arc and network id values.

 

4. Merge arc links with line segments

http_download_1444329909540_6032.png

FeatureMerger: The two links generated in Step 2 are merged back on to the line information, so each line knows its optimum preceding and succeeding link.

 

5. Analyze arcs and sort them into order

http_download_1444329909719_6032.png

Tester: Use Testers to remove unconnected lines and sort end lines from middle lines.

AttributeCreator: Set an attribute to be the sort order on the arcs.

Sorter: Sort the arcs so that the lines are sorted.

PythonCaller: Routine to establish a unique id for each connected set of lines.

 

6. Final merge and Line join

http_download_144432991067_6032.png

FeatureMerger: Merge the calculated join Id onto each original line feature.

LineJoiner: The lines are then connected by a LineJoiner with the Group By set to the unique id and the StreetName.

 

Result

http_download_1444329910351_6032.png

A template containing an annotated workspace and sample source data are attached.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.