Identify multipart polylines
Summary :: Usage :: Parameters :: Outputs :: Warnings :: Limitations :: Code sample
Summary
Checks for multipart polylines, any found are logged in the error log table.
Usage
This tool checks for multipart polylines. This is a line that is composed of several parts but visually looks like a single continuous line. Such data can cause errors in subsequent processing of the network. It is strongly advised that all multipart lines are simplified into single parts in your river network layer. Mulitpart can occur in several ways, two very common multipart scenarios are discussed below:
- A classic situation is where digitising has captured the boundary of a lake along with the inflow and outflow. The resulting feature is a multi-part polyline. The image below shows a multi-part polyline "exploded" into its individual parts, as you can see the middle part (2) forms a loop.
Part 2 in the image above still needs to be converted to a single centre line for the lake to ensure correct network connectivity. If the image above was a river braid instead of a lake boundary; the wrongly digitised multi-part polyline (part 2) would need to be split into 2 lines, left and right channel. So what you do with a multi-part polyline depends upon what is was capturing.
- A multi-part feature is shown below.
The first image shows the polylines with their direction of flow indicated by an arrow at the TO-end of the line, one polyline is not showing the expected arrow |
Selecting the polyline shows up an unusual selection |
Entering edit mode and selecting edit vertices ( |
|
|
|
Any selection on the input river network is cleared and then the tool checks all polylines in the river network. Any found to be multipart have their polyline ID written to an error log table called tblMultiparts. 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. You can use the explode multipart feature editing tool to convert your polyline into single parts, which you then merge or remove as needed.
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 |
Outputs
This tool creates a stand alone table named tblMultiparts, if any multipart geometries are encountered 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
Having identified multipart 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
All polylines in the river network are tested, if a selection existed this is cleared prior to processing.
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.scrQCIsMultipart_RivEX(fc, 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")
else:
print("No error table created!")
except arcpy.ExecuteError:
print("FAILED to quality control network")