Identify intersecting polylines
Summary :: Usage :: Parameters :: Outputs :: Warnings :: Limitations :: Code sample
Summary
Checks for intersecting polylines, any found are logged in the error log table. Optionally create a point dataset to visualise location of intersections. Use this tool to find self-intersections within a polyline.
Usage
This tool checks for intersecting polylines. Polylines should connect at nodes (tributary junctions). This is one form of intersection. Lines that cross each other are another form of intersection and can be topological errors. This tool finds non-node intersections. The image below demonstrates 2 non-node intersections typically observed in river networks. The red circle identifies where polylines cross each other where there is no green node.
The tool can optionally export the non-node intersections to a point Feature Class. Such a dataset it not maintained by RivEX but it provides a useful pointer to the intersection location. The intersection output is always overwritten if the Feature Class already exists. If this tool is run from within ArcPro then the default behaviour is to load the intersection point layer into the map symbolised with black squares.
Intersections types:
- typically lines that cross each other where one would expect to find a node.
- may appear to be a valid tributary junctions yet RivEX identifies it as an intersection. These are sometimes due to XY precision of coordinates, especially if the dataset was not created in ArcPro. You might find two very close vertices and to remove the intersection you simply delete one of the vertices.
How you deal with the intersection depends upon the type of intersection that is occurring. It may be a simple matter of entering edit mode and deleting a single vertex. Alternatively you may have to split the polyline, snap the intersection to the new node and re-run RivEX to rebuild node IDs and any attribution you have done.
These types of errors are often over looked as the connectivity of the network is not compromised. They do influence other types of processing. For example, if you use RivEX to build a pseudo node free network then such intersections will cause multi-part features to be created when the GIS attempts to union the polylines for removing the pseudo nodes.
Any found to be intersecting have their polyline ID written to an error log table called tblIntersections. If the table already exists then a new table name is created with a simple numeric suffix.
The tool optionally adds the error log table to the map (default) and if selected builds a standard relate between river network layer and error log table. You can use the relate to select and jump to the polyline to streamline your editing experience.
Parameters
Name |
Help |
Data type |
River Network |
The river network. For best results the network should be within a File GeoDatabase |
Feature Layer |
Add Error Log Table to Map |
If this is ticked (default) the error log table will be added to the map for your convenience if any errors were found. |
Boolean |
Build a Relate for Error Log |
If this tick box is checked then the error log table must be loaded into the map and RivEX builds a standard relate between the Error Log table and the river network layer. You can use the relate to help you jump to and review the error. |
Boolean |
Intersection Points |
An optional point dataset created by RivEX which shows the location of the intersection. This can be used to quickly identify the location which you will need to edit. This dataset is not maintained by RivEX and will be overwritten if it already exists. It is strongly suggested that you write this output to your temporary file geodatabase location. |
Feature Class |
Outputs
This tool creates a stand alone table named tblIntersections, if any polylines are found intersecting within the river network. The table is created in the RivEX workspace folder and stored in the File GeoDatabase found in ..\RivEX_Workspace\ErrorLogs\fGDB_RivEXErrorLogs.gdb
Advice on the structure of the error log table and how it can be used is found within this section of the manual. Take note of the warning if you plan to construct a model using the error log output in subsequent processing.
Warnings
If your network contains features other than natural water courses, for example canals, you may have a genuine crossing of lines due to an aqueduct. Whilst you may want to preserve such features be aware that much of the logic behind RivEX is expecting natural dendritic patterns, not features cutting across channels and in some cases entire catchments.
Having identified intersecting features and corrected them, you will have changed the topology of the network. You must re-run your network through the Extract Network Topology and write to Workspace tool to rebuild and correctly attribute the node and polyline fields in your river network.
With the release of ArcGIS Pro 3.2.1 a switch control appears on parameters that accept tables\feature classes, do not interact with it! More advice here.
Limitations
Any selection on the input layer is cleared and then the tool checks all polylines in the river network.
Code sample
A minimum code example showing how to call this tool in a python script. This can be run in console or your preferred IDE. If you right click on the tool in the RivEX toolbox and select properties you can view parameter order.
import arcpy
# Import RivEX toolbox
arcpy.ImportToolbox(r"C:\RivEX_ArcPro\RivEX.atbx")
try:
# Input river Feature Class
fc = r"C:\Temp\ORN\ORN.gdb\ORN"
# Run RivEX quality control tool
res = arcpy.scrQCIntersections_RivEX(fc, False, False, r"C:\Temp\IntPoints.shp")
# Get intersection points
fcIntersections = res.getOutput(0)
# The rivers Feature Class, a derived output
fcRivers = res.getOutput(1)
# Get error table
tblError = res.getOutput(2)
# Check if error table exists
if arcpy.Exists(fcIntersections):
# Count number of intersections points created
res = arcpy.GetCount_management(fcIntersections)
n = int(res.getOutput(0))
if n > 0:
print(str(n) + " intersections were recorded")
else:
print("No intersections found!")
except arcpy.ExecuteError:
print("FAILED to quality control network")