Summary :: Usage :: Parameters :: Outputs :: Warnings :: Limitations :: Code sample


Checks for spikes within polylines, any found are logged in the error log table.‌


This tool checks for spikes within a polylines. A common digitising error is a spike which is a very acute angle within the polyline, an angle that would not happen in the real world. Spikes are typically very short, they are digitising errors and can be very difficult to see.  An example is shown below.

Example of a spike

They do not alter the network topology but if removed they would cause the network to shorten. This tool searches for spikes within a polyline geometry. It will not search for spikes caused by the junctions of polylines.  A polyline could potentially have multiple spikes along its length and would record in the error table as many instances of the polyline as there were spikes along its length. The spike can be removed from the polyline by deleting the single vertex that is causing the "Z-bend".

This tool uses the law of cosines to find angles that fall below a specified value. The default is 30° but you can change this. If you increase this value you will start to identify angles that may be legitimate, e.g. a right angle bend in a drainage ditch.

Any found to have spikes have their polyline ID written to an error log table called tblSpikes. 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.




Data type

River Network

The river network. For best results the network should be within a File GeoDatabase

Feature Layer


The angle to test for presence of a spike. The default is 30°. This value must be greater than zero and less than or equal to 180.


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.


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.



This tool creates a stand alone table named tblSpikes, if any polylines within the river network contain spikes.  The table is created in the RivEX workspace folder and stored in the File GeoDatabase found in ..\RivEX_Workspace\ErrorLogs\fGDB_RivEXErrorLogs.gdb

For each spike found, the polyline ID and vertex coordinates are written to the table. You would then use the ID number to identify the polyline with a spike and then use the vertex coordinates to zoom in and make the edit required to remove it. You can either move the vertex in-line with the river segment or simply delete it. In the image below polyline 32849 occurs twice as there are two spikes along its length.


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.


Removing spikes does not alter the connectivity of a network but it will shorten your network (albeit a small amount); any previous analysis that involved distances should be re-run.

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.


All polylines in the river network are tested, if a selection existed this is cleared prior to processing.  This tool locates spikes within the length of a polyline, not spikes caused by two polylines joining at an acute angle.

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

    # Input river Feature Class
    fc = r"C:\Temp\ORN\ORN.gdb\ORN"

    # Run RivEX quality control tool, using default angle of 30 degrees
    res = arcpy.srcQCSpikes_RivEX(fc, 30, False, False)

    # The rivers Feature Class, a derived output
    fcRivers = res.getOutput(0)
    # Get error table
    tblError = res.getOutput(1)

    # Check if error table exists
    if arcpy.Exists(tblError):
        # Count number of rows
        res = arcpy.GetCount_management(tblError)
        n = int(res.getOutput(0))
        if n > 0:
            print(str(n) + " error(s) were recorded")
        print("No error table created!")
except arcpy.ExecuteError:
    print("FAILED to quality control network")

Return to top of page