Skip To Content

Delete Routes

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.
      Caution:

      Running Delete Routes without using Delete associated centerlines, Delete associated calibration points, and Delete associated events might result in those centerlines, calibration points, and events not referencing to any route.

  • 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 a route is selected in a Line Network, all routes in the same line are deleted across all 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.

  • Caution:

    If the Delete Routes tool is run outside an edit session, the deleted routes cannot be undone.

  • In the case of routes that have a null routeId or lineId, the tool will run but records will not be deleted.

  • The Delete Routes tool cannot be run on network layers in ArcGIS Pro when a time filter is turned on.

Syntax

DeleteRoutes_locref (in_route_features, {delete_associated_calibration_points}, {delete_associated_events}, {delete_associated_centerlines})
ParameterExplanationData 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.

  • DELETE_CALIBRATION_POINTSAny calibration points associated with the routes will be deleted.
  • NO_DELETE_CALIBRATION_POINTSAny calibration points associated with the routes will not be deleted. This is the default.
Boolean
delete_associated_events
(Optional)

Option to delete events associated with the deleted routes.

  • DELETE_EVENTSAny events associated with the routes will be deleted.
  • NO_DELETE_EVENTSAny events associated with the routes will not be deleted. This is the default.
Boolean
delete_associated_centerlines
(Optional)

Option to delete centerlines that are exclusively associated with the deleted routes.

  • DELETE_CENTERLINESCenterlines exclusively associated with the selected routes will be deleted. If centerlines are shared between networks, those common centerlines will not be deleted.
  • NO_DELETE_CENTERLINESCenterlines will not be deleted. This is the default.
Boolean

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: ArcGIS Pipeline Referencing


# tool variables
in_route_features= "PipelineNetwork"

# set current workspace
arcpy.env.workspace = "C:/Data/UPDM.gdb"

# execute the tool
arcpy.locref.DeleteRoutes('PipelineNetwork', '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.
# Requires: ArcGIS Pipeline Referencing


# Import arcpy module
import arcpy

#Check out the license
arcpy.CheckOutExtension("LocationReferencing")

#Provide the path of database
arcpy.env.workspace = r"C:\Users\Desktop\PipelineReferencing.gdb\LineNetwork"

#Convert network feature class to layer
arcpy.MakeFeatureLayer_management("LineNetwork", "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 ArcGIS Pipeline Referencing
  • ArcGIS Desktop Standard: Requires ArcGIS Pipeline Referencing
  • ArcGIS Desktop Advanced: Requires ArcGIS Pipeline Referencing

Related topics