Available with Location Referencing license.
Summary
Deletes routes and associated data elements from the LRS Network.
Usage
As part of deleting routes, the Delete Routes tool will also do the following:
- Delete all Centerline Sequence records that have the routeId of deleted routes.
- Delete all records in the lrs_edit_log table related to deleted routes.
- Optionally delete associated centerlines, calibration points, and events.
The input must be a network feature class registered with an LRS Network.
Routes that need to be deleted should be selected before running the tool. Selection on an LRS Network feature class can be performed using the Select tool, definition queries.
If no routes have been selected in the LRS Network feature class, the tool will fail.
Selected records of a route with the same routeId will be deleted across time.
If the Delete associated calibration points check box is checked, calibration points associated with the routes will be deleted across time.
If the Delete associated events check box is checked, all events registered with the network that have the same routeId of a deleted route will be deleted across time.
If the Delete associated centerlines check box is checked, centerlines associated with the selected routes will be deleted. If centerlines are shared between networks, those common centerlines will not be deleted.
It is not recommended to run this tool against the default version of a database.
If Delete Routes is run within an edit session, the deleted routes can be undone.
In the case of routes that have a null routeId, the tool will run but records will not be deleted.
If conflict prevention is enabled when Delete Routes runs, the selected routes will be locked. If locks cannot be acquired, the tool will not run.
Syntax
DeleteRoutes(in_route_features, {delete_associated_calibration_points}, {delete_associated_events}, {delete_associated_centerlines})
Parameter | Explanation | Data Type |
in_route_features | Specifies the route feature class registered with the network. | Feature Layer |
delete_associated_calibration_points (Optional) | Option to delete calibration points associated with the deleted routes.
| Boolean |
delete_associated_events (Optional) | Option to delete events associated with the deleted routes.
| Boolean |
delete_associated_centerlines (Optional) | Option to delete centerlines that are exclusively associated with the deleted routes.
| Boolean |
Derived Output
Name | Explanation | Data Type |
updated_route_features | Updated LRS Network feature class. | Feature Layer |
out_details_file | Details the routes deleted from the LRS Network feature class. | Text File |
Code sample
DeleteRoutes example 1 (Python window)
The following Python window script demonstrates how to use the DeleteRoutes function in immediate mode.
# Name: DeleteRoutes.py
# Description: Deletes routes and associated data elements from LRS Network.
# Requires: Roads and Highway license
# tool variables
in_route_features= "StateRoutes"
# set current workspace
arcpy.env.workspace="C:/Data/RH_DOT.gdb"
# execute the tool
arcpy.locref.DeleteRoutes("StateRoutes", "DELETE_CALIBRATION_POINTS", "DELETE_EVENTS", "DELETE_CENTERLINES")
DeleteRoutes example 2 (stand-alone script)
The following stand-alone script demonstrates how to use the DeleteRoutes function.
# Name: DeleteRoutes.py
# Description: Deletes routes and associated data elements from LRS Network.
# Requirements: Roads and Highways license
# Import arcpy module
import arcpy
#Check out the license
arcpy.CheckOutExtension("Highways")
#Provide the path of database
arcpy.env.workspace = r"C:\Users\Desktop\RoadsAndHighwaysData.gdb"
#Convert network feature class to layer
arcpy.MakeFeatureLayer_management("AllRoutes", "networklyr")
# Process: Select Layer By Attribute
arcpy.SelectLayerByAttribute_management("networklyr", "NEW_SELECTION", "RouteID = '11316262800'")
# Run Delete Routes tool
arcpy.DeleteRoutes_locref("networklyr", "DELETE_CALIBRATION_POINTS", "DELETE_EVENTS", "DELETE_CENTERLINES")
print("Successfully deleted the selected route...")
Environments
Licensing information
- ArcGIS Desktop Basic: Requires Roads and Highways
- ArcGIS Desktop Standard: Requires Roads and Highways
- ArcGIS Desktop Advanced: Requires Roads and Highways