Delete Routes (Location Referencing)

Available with Location Referencing license.

Summary

Deletes routes and associated data elements from the LRS Network.

Usage

  • An LRS dataset is required to run this tool.

    Learn more about creating an LRS dataset in ArcGIS Pipeline Referencing or creating an LRS dataset in ArcGIS Roads and Highways .

  • As part of deleting routes, you can also use the Delete Routes tool to 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 the Delete associated centerlines, Delete associated calibration points, and Delete associated events parameters may 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.

  • Select routes that need to be deleted before running the tool. Selection on an LRS Network feature class can be performed using the Select tool or definition queries.

  • If no routes have been selected in the LRS Network feature class, the tool will fail.

  • Selected route records with the same routeId will be deleted across time.

  • If a route is selected in a Line Network, all routes in the same line will be deleted across time.

  • If the Delete associated calibration points parameter is checked, calibration points associated with the routes will be deleted across time.

  • If the Delete associated events parameter 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 parameter 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 recommended that you do not run this tool on the default version of a database.

  • If this tool is run in an edit session, the deleted routes can be undone.

  • Caution:

    If this 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.

  • This tool supports conflict prevention and will attempt to acquire and transfer locks.

    Learn more about conflict prevention in ArcGIS Pipeline Referencing or conflict prevention in ArcGIS Roads and Highways.

Parameters

LabelExplanationData Type
Input Route Features

The route feature class registered with the network.

Feature Layer
Delete associated calibration points
(Optional)

Specifies whether calibration points associated with the deleted routes will be deleted.

  • Checked—Calibration points associated with the routes will be deleted.
  • Unchecked—Calibration points associated with the routes will not be deleted. This is the default.
Boolean
Delete associated events
(Optional)

Specifies whether events associated with the deleted routes will be deleted.

  • Checked—Events associated with the routes will be deleted.
  • Unchecked—Events associated with the routes will not be deleted. This is the default.
Boolean
Delete associated centerlines
(Optional)

Specifies whether centerlines that are exclusively associated with the deleted routes will be deleted.

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

Derived Output

LabelExplanationData Type
Updated Route Features

Updated LRS Network feature class.

Feature Layer
Output Results File

A text file that details the routes deleted from the LRS Network feature class.

Text File
Output Derived Route Features

The updated derived route feature layer.

Feature Layer

arcpy.locref.DeleteRoutes(in_route_features, {delete_associated_calibration_points}, {delete_associated_events}, {delete_associated_centerlines})
NameExplanationData Type
in_route_features

The route feature class registered with the network.

Feature Layer
delete_associated_calibration_points
(Optional)

Specifies whether calibration points associated with the deleted routes will be deleted.

  • DELETE_CALIBRATION_POINTSCalibration points associated with the routes will be deleted.
  • NO_DELETE_CALIBRATION_POINTSCalibration points associated with the routes will not be deleted. This is the default.
Boolean
delete_associated_events
(Optional)

Specifies whether events associated with the deleted routes will be deleted.

  • DELETE_EVENTSEvents associated with the routes will be deleted.
  • NO_DELETE_EVENTSEvents associated with the routes will not be deleted. This is the default.
Boolean
delete_associated_centerlines
(Optional)

Specifies whether centerlines that are exclusively associated with the deleted routes will be deleted.

  • 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

Derived Output

NameExplanationData Type
updated_route_features

Updated LRS Network feature class.

Feature Layer
out_details_file

A text file that details the routes deleted from the LRS Network feature class.

Text File
out_derived_route_features

The updated derived route feature layer.

Feature Layer

Code sample

DeleteRoutes example 1 (Python window)

The following Python window script demonstrates how to use the DeleteRoutes function in immediate mode.

# Name: DeleteRoutes_ex1.py
# Description: Delete routes and associated data elements from an LRS Network in the Python window
# Requires: ArcGIS Location Referencing

# Set current workspace
arcpy.env.workspace = "C:\Data\UPDM.gdb"

# Delete Routes tool variables
in_route_features = "PipelineNetwork"
delete_associated_calibration_points = "DELETE_CALIBRATION_POINTS" 
delete_associated_events = "DELETE_EVENTS"
delete_associated_centerlines = "DELETE_CENTERLINES"

# Execute Delete Routes. (Input route features must be selected prior to tool execution)
arcpy.locref.DeleteRoutes(in_route_features, delete_associated_calibration_points, delete_associated_events, delete_associated_centerlines)
DeleteRoutes example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the DeleteRoutes function.

# Name: DeleteRoutes_ex2.py
# Description: Delete routes and associated data elements from an LRS Network.
# Requires: ArcGIS Location Referencing

# Import arcpy module
import arcpy

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

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

# Convert network feature class to layer
arcpy.management.MakeFeatureLayer("LineNetwork", "networklyr")

# Process: Select Layer By Attribute
arcpy.management.SelectLayerByAttribute("networklyr", "NEW_SELECTION", "RouteID = '11316262800'")

# Run Delete Routes tool
arcpy.locref.DeleteRoutes("networklyr", "DELETE_CALIBRATION_POINTS", "DELETE_EVENTS", "DELETE_CENTERLINES")

print("Successfully deleted the selected route...")

# Check in license
arcpy.CheckInExtension('LocationReferencing')
DeleteRoutes example 3 (stand-alone script)

The following stand-alone script demonstrates how to use the DeleteRoutes function in a feature service.

# Name: DeleteRoutes_Pro_Ex3.py
# Description: Delete routes in stand-alone mode using a feature service. It is recommended to work in a version and post it into the default version.
# Requires: ArcGIS Location Referencing

# Import arcpy module
import arcpy

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

# Set tool variables
delete_associated_calibration_points = "DELETE_CALIBRATION_POINTS"
delete_associated_events = "DELETE_EVENTS"
delete_associated_centerlines = "DELETE_CENTERLINES"

# Input LRS route network is in a feature service. Sign into portal is required to access the feature service.
arcpy.SignInToPortal('https://yourdomain.com/portal', 'username', 'password')

## Make a layer of the LRS route network from the feature service for applying selection. Here, 1 corresponds to the LRS route network
in_route_layer = arcpy.management.MakeFeatureLayer("https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/1", 'route_layer')

## Process: Select Layer by attribute as required
arcpy.management.SelectLayerByAttribute(in_route_layer, "NEW_SELECTION", "RouteID = 'routeid1'")

# Process : Delete Routes
arcpy.locref.DeleteRoutes( in_route_layer, delete_associated_calibration_points, delete_associated_events, delete_associated_centerlines)

# Check in license
arcpy.CheckInExtension('LocationReferencing')

Environments

Licensing information

  • Basic: Requires ArcGIS Location Referencing (ArcGIS Pipeline Referencing or ArcGIS Roads and Highways)
  • Standard: Requires ArcGIS Location Referencing (ArcGIS Pipeline Referencing or ArcGIS Roads and Highways)
  • Advanced: Requires ArcGIS Location Referencing (ArcGIS Pipeline Referencing or ArcGIS Roads and Highways)

Related topics