Append Routes (Location Referencing)

Available with Location Referencing license.

Summary

Appends routes from an input polyline into an LRS Network.

Note:

When the target layer is a feature service layer, the validation results for this tool are written to the ArcGIS Server directory. This file is automatically cleaned up in 10 minutes by default, which may not be enough time to process all of the validations and write them to the workstation running ArcGIS Pro. For larger data loads, it is recommended that you adjust the maximum file age to at least one hour.

Learn more about adjusting this server directory setting in Manager

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 .

  • This tool will create centerlines in the target LRS dataset as well as routes in the target LRS Network.

  • The output routes will have x-, y-, and z-values from the input polyline vertices, but no m-values will be appended.

  • Create any new fields that will be used for field mapping in the underlying LRS Network feature class before appending routes.

  • The spatial reference, x,y resolution, and x,y tolerance of the input polyline feature class and the target LRS Network must match.

  • A text log is written locally that states that the tool has been run and contains information about routes that failed validation. The tool messages provide the location of the text log, which is in the temporary directory.

  • The output of this tool is a modified LRS Network that has had routes appended and centerline features created.

  • When conflict prevention is enabled, the following are supported:

    • If the routes to be appended are new, no locks will be acquired for those routes.
    • For other load types, such as Retire by route ID and Replace by route ID, locks will be automatically acquired, if available.
    • If the locks cannot be acquired, the tool will not run and will provide the text file of the offending locks.
    • If working in the default version, the locks acquired will be released automatically when the tool finishes running successfully.
    • If working in a child version, the acquired locks will remain in ON POST status after the tool completes. Post or delete the version to release the locks.
    • If working in a child version and the tool process is canceled by interruption, the locks will be acquired and remain with the releasable status as Yes. The lock owner can release the lock.

      Learn more about releasing locks in ArcGIS Pipeline Referencing or releasing locks in ArcGIS Roads and Highways.

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

  • If the input feature class contains curves, the curves will be densified.

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

  • If the target LRS Network is configured as a line network with support for a multifield route ID, the following parameters are not required for appending routes:

    • Route Name Field
    • Line Name Field

  • When appending new routes using the Add value for the Load Type parameter, if the target LRS network has a route name configured, routes can be appended using the route name. If the route IDs are null, route IDs will be automatically generated for the appended routes.

  • The tool checks that the line order values are greater than zero and in increments of 100 with flow and direction of routes in a line. Incorrect line order values cause the tool to fail. The output text file reports the incorrect line order values as errors. The tool will run successfully once these errors are fixed.

  • The tool checks for a utility network that is configured with the LRS Network to which the routes are being loaded, and if a utility network is found, considers existing centerlines when appending in routes. If the centerline that you append to a route does not have a CenterlineID value, one will be created and a centerline sequence record will be added. If a CenterlineID value exists where you append a route, the existing centerline sequence record will be updated with the appended route's RouteID value.

    The following preprocessing conditions will result in a logged error that must be resolved before the tool can be run to completion:

    • Loading the route feature requires a centerline split.
    • The x,y and z geometries of centerlines and routes do not match.
    • A centerline is a partial match (for example, if part of the centerline is outside the x-, y-, and z-tolerance).
    • An appended route has one or more whole centerlines that match the geometry, but there are locations where no centerlines exist.
    • Overlapping centerlines are detected (the utility network doesn’t allow overlapping centerlines).
    • There are no centerlines that match an appended route.

    Learn more about managing Pipeline Referencing and a utility network together

  • This tool will fail if the Load Type parameter is set to Replace by route ID or Retire by route ID and the source route does not have the same RouteName and RouteID values as the target route.

  • If the Replace by route ID value is specified for the Load Type parameter, any routes that are replaced will have the route and centerline sequence records replaced. Calibration points on the route will be deleted and must be re-created or reloaded.

Parameters

LabelExplanationData Type
Source Routes

The input from which the routes will be derived. The input can be a polyline feature class, shapefile, feature service, or LRS Network feature class.

Feature Layer
LRS Network

The target LRS Network into which the routes will be loaded.

Feature Layer
Route ID Field

The field in the input polyline feature class that will be mapped to the LRS Network route ID. The field type must match the RouteID field type of the target LRS Network and must be either a string or GUID field type. If it is a text field, the field length must be shorter than or equal to the length of the target RouteID field.

Field
Route Name Field

The field in the input polyline feature class that will be mapped as the LRS Network route name. The field must be a string field, and the field length must be shorter than or equal to the length of the target route name field.

Field
From Date Field
(Optional)

A date field in the input polyline feature class that will be mapped as the From Date Field value in the LRS Network. If the field is not mapped, a null value representing the beginning of time will be provided for all appended routes.

Field
To Date Field
(Optional)

A date field in the input polyline feature class that will be mapped as the To Date Field value in the LRS Network. If the field is not mapped, a null value representing the end of time will be provided for all appended routes.

Field
Line ID Field
(Optional)

The field in the input polyline feature class that will be mapped as the LRS Network line ID. This parameter is only used if the target LRS Network is an LRS line network. The field type and length must match the RouteID field type and length of the centerline sequence table.

Field
Line Name Field
(Optional)

The string field in the input polyline feature class that will be mapped as the LRS Network line name. This parameter is only used if the target LRS Network is an LRS line network.

Field
Line Order Field
(Optional)

The long integer field in the input polyline feature class that will be mapped as the LRS Network line order. This parameter is only used if the target LRS Network is an LRS line network.

Learn more about line networks and line order in Pipeline Referencing or line networks and line order in Roads and Highways.

Field
Field Map
(Optional)

Controls how attribute information in the source route fields will be transferred to the input LRS Network. Fields cannot be added to or removed from the target LRS Network because the data of the source routes is appended to an existing LRS Network that has a predefined schema. While you can set merge rules for each output field, the tool will ignore them.

Field Mappings
Load Type
(Optional)

Specifies how appended routes with measure or temporality overlaps with identical route IDs will be loaded into the network feature class.

  • AddThe appended routes will be loaded into the target LRS Network. If any route ID in the source routes already exists in the target LRS Network with the same temporality, it will be written to the output log as a duplicate route and must be corrected or filtered out before completing the loading process. This is the default.
  • Retire by route IDThe appended routes will be loaded into the target LRS Network and any routes in the target LRS Network that have the same route ID and temporality overlap as the appended routes will be retired. If the appended route eclipses a target route with the same route ID, the target route will be deleted.
  • Replace by route IDThe appended routes will be loaded into the target LRS Network and any routes in the target LRS Network with the same route ID as the appended routes will be deleted.
String
Load Field
(Optional)

Specifies the field that will be used for loading routes.

  • Route ID The routes will be loaded using the RouteID field. This is the default.
  • Route Name The routes will be loaded using the RouteName field. This option is only available for the networks with RouteName configured in the LRS Network for the Add load type (load_type = "ADD" in Python).
String

Derived Output

LabelExplanationData Type
LRS Network

The updated LRS Network feature layer.

Feature Layer
Output Results File

The text file that details changes made by the tool.

Text File

arcpy.locref.AppendRoutes(source_routes, in_lrs_network, route_id_field, route_name_field, {from_date_field}, {to_date_field}, {line_id_field}, {line_name_field}, {line_order_field}, {field_map}, {load_type}, {load_field})
NameExplanationData Type
source_routes

The input from which the routes will be derived. The input can be a polyline feature class, shapefile, feature service, or LRS Network feature class.

Feature Layer
in_lrs_network

The target LRS Network into which the routes will be loaded.

Feature Layer
route_id_field

The field in the input polyline feature class that will be mapped to the LRS Network route ID. The field type must match the RouteID field type of the target LRS Network and must be either a string or GUID field type. If it is a text field, the field length must be shorter than or equal to the length of the target RouteID field.

Field
route_name_field

The field in the input polyline feature class that will be mapped as the LRS Network route name. The field must be a string field, and the field length must be shorter than or equal to the length of the target route name field.

Field
from_date_field
(Optional)

A date field in the input polyline feature class that will be mapped as the From Date Field value in the LRS Network. If the field is not mapped, a null value representing the beginning of time will be provided for all appended routes.

Field
to_date_field
(Optional)

A date field in the input polyline feature class that will be mapped as the To Date Field value in the LRS Network. If the field is not mapped, a null value representing the end of time will be provided for all appended routes.

Field
line_id_field
(Optional)

The field in the input polyline feature class that will be mapped as the LRS Network line ID. This parameter is only used if the target LRS Network is an LRS line network. The field type and length must match the RouteID field type and length of the centerline sequence table.

Field
line_name_field
(Optional)

The string field in the input polyline feature class that will be mapped as the LRS Network line name. This parameter is only used if the target LRS Network is an LRS line network.

Field
line_order_field
(Optional)

The long integer field in the input polyline feature class that will be mapped as the LRS Network line order. This parameter is only used if the target LRS Network is an LRS line network.

Learn more about line networks and line order in Pipeline Referencing or line networks and line order in Roads and Highways.

Field
field_map
(Optional)

Controls how attribute information in the source route fields will be transferred to the input LRS Network. Fields cannot be added to or removed from the target LRS Network because the data of the source routes is appended to an existing LRS Network that has a predefined schema (field definitions). While you can set merge rules for each output field, the tool will ignore them. The ArcPy FieldMappings class can be used to define this parameter.

Field Mappings
load_type
(Optional)

Specifies how appended routes with measure or temporality overlaps with identical route IDs will be loaded into the network feature class.

  • ADDThe appended routes will be loaded into the target LRS Network. If any route ID in the source routes already exists in the target LRS Network with the same temporality, it will be written to the output log as a duplicate route and must be corrected or filtered out before completing the loading process. This is the default.
  • RETIRE_BY_ROUTE_IDThe appended routes will be loaded into the target LRS Network and any routes in the target LRS Network that have the same route ID and temporality overlap as the appended routes will be retired. If the appended route eclipses a target route with the same route ID, the target route will be deleted.
  • REPLACE_BY_ROUTE_IDThe appended routes will be loaded into the target LRS Network and any routes in the target LRS Network with the same route ID as the appended routes will be deleted.
String
load_field
(Optional)

Specifies the field that will be used for loading routes.

  • ROUTE_ID The routes will be loaded using the RouteID field. This is the default.
  • ROUTE_NAME The routes will be loaded using the RouteName field. This option is only available for the networks with RouteName configured in the LRS Network for the Add load type (load_type = "ADD" in Python).
String

Derived Output

NameExplanationData Type
out_lrs_network

The updated LRS Network feature layer.

Feature Layer
out_details_file

The text file that details changes made by the tool.

Text File

Code sample

AppendRoutes example 1 (Python window)

The following demonstrates how to use the AppendRoutes function in the Python window to append routes into an existing LRS Network, replacing those routes where an overlap occurs.

# Name: AppendRoutes_ex1.py
# Description: Append routes into an existing LRS Network, replacing routes where an overlap occurs.
# Requires: ArcGIS Location Referencing

# Set current workspace
arcpy.env.workspace= r"C:\DOT.gdb"

# Set tool variables
source_routes = r"C:\Data\Input.gdb\RoutestoAppend"
in_lrs_network = r"C:\Data\DOT.gdb\LRS\StateRoutes"
route_id_field = "RouteId"
route_name_field = None
from_date_field = "FromDate"
to_date_field = "ToDate"
line_id_field = None
line_name_field = None
line_order_field = None
field_map = None
load_type = "REPLACE_BY_ROUTE_ID"
load_field = None

# Execute the tool
arcpy.locref.AppendRoutes(source_routes, in_lrs_network, route_id_field, route_name_field, from_date_field, to_date_field, line_id_field, line_name_field, line_order_field, field_map, load_type,load_field)
AppendRoutes example 2 (stand-alone script)

The following demonstrates how to use the AppendRoutes function as a stand-alone Python script.

# Name: AppendRoutes_ex2.py
# Description: Appending new routes into an existing LRS network using Route Name in python stand alone script.
# Requires: ArcGIS Location Referencing

# Import arcpy module
import arcpy

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


# Set tool variables:
source_routes = r"C:\Data\Input.gdb\RoutestoAppend"
in_lrs_network = r"C:\Data\pipelinereferencing.gdb\LRS\EngineeringNetwork"
route_id_field = "RouteId"
route_name_field = "RouteName"
from_date_field = "FromDate"
to_date_field = "ToDate"
line_id_field = "LineId"
line_name_field = "LineName"
line_order_field = "LineOrder"
field_map = None
load_type = "ADD"
load_field = "RouteName"


# Process: Append Routes
arcpy.locref.AppendRoutes(source_routes, in_lrs_network, route_id_field, route_name_field, from_date_field, to_date_field, line_id_field, line_name_field, line_order_field, field_map, load_type,load_field)

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

The following demonstrates how to use the AppendRoutes function as a stand-alone Python script for a user-generated route ID network.

# Name: AppendRoutes_ex3.py
# Description: Append records into an existing usergenerated routeId network feature class in a stand-alone script.
# Source fields: RS and RN, Target fields: RouteSystem and RouteNumber
# Requires: ArcGIS Location Referencing 

# Import arcpy module
import arcpy

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

# Local variables:
source_routes = r"C:\Data\DOT.gdb\LRS\RoutestoAppend"
in_lrs_network = r"C:\Data\DOT.gdb\LRS\StateRoutes"
route_id_field = "RouteId"
route_name_field = None
from_date_field = "FromDate"
to_date_field = "ToDate"
line_id_field = None
line_name_field = None
line_order_field = None
load_type = "ADD"
load_field = None

# Define field mappings object
fieldMappings = arcpy.FieldMappings()  

# Add input fields
fldmap1 = arcpy.FieldMap()
fldmap1.addInputField(source_routes, "RS")

fldmap2 = arcpy.FieldMap()
fldmap2.addInputField(source_routes, "RN")

# Set output fields
fld1 = fldmap1.outputField  
fld1.name = "RouteSystem"
fld1.aliasName = "RouteSystem"
fldmap1.outputField = fld1

fld2 = fldmap2.outputField  
fld2.name = "RouteNumber"
fld2.aliasName = "RouteNumber"
fldmap2.outputField = fld2

# Add output fields to field mappings object
fieldMappings.addFieldMap(fldmap1)
fieldMappings.addFieldMap(fldmap2)

# Execute: Append Routes
arcpy.locref.AppendRoutes(source_routes, in_lrs_network, route_id_field, route_name_field, from_date_field, to_date_field, line_id_field, line_name_field, line_order_field, fieldMappings, load_type,load_field)


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

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

# Name: AppendRoutes_Pro_Ex4.py
# Description: Append routes using a feature service in a stand-alone script. 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 any necessary licenses.
arcpy.CheckOutExtension("LocationReferencing")

# Set tool variables.
source_routes = r"C:\LocationReferencing\LR.gdb\LRS\routes"
route_id_field = "ROUTEID"
route_name_field = "ROUTENAME"
from_date_field = "FROMDATE"
to_date_field = "TODATE"
line_id_field = "LINEID"
line_name_field = "LINENAME"
line_order_field = "ORDERID"
field_mapping = r'CREATIONUSER "Creation User" true true false 50 Text 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\routes,CREATIONUSER,0,50;DATECREATED "Date Created" true true false 8 Date 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\routes,DATECREATED,-1,-1;DATEMODIFIED "Date Modified" true true false 8 Date 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\routes,DATEMODIFIED,-1,-1;LASTUSER "Last User" true true false 50 Text 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\routes,LASTUSER,0,50;EVENTSOURCE "Event Source" true true false 50 Text 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\routes,EVENTSOURCE,0,50;LEGACYID "Legacy ID" true true false 38 Text 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\routes,LEGACYID,0,38;ENGFROMM "ENGFROMM" true true false 0 Double 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\routes,ENGFROMM,-1,-1;ENGTOM "ENGTOM" true true false 0 Double 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\routes,ENGTOM,-1,-1;OBJECTSTATUS "Object Status" true true false 20 Text 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\routes,OBJECTSTATUS,0,20;CONTINFROMM "Continuous from Measure" true true false 0 Double 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\routes,CONTINFROMM,-1,-1;CONTINTOM "Continuous to Measure" true true false 0 Double 0 0,First,#,C:\LocationReferencing\LR.gdb\LRS\routes,CONTINTOM,-1,-1'
load_type = "REPLACE_BY_ROUTE_ID"
load_field = None

## Target Route is in feature service. Signing in portal is required to access the feature service.
arcpy.SignInToPortal('https://yourdomain.com/portal', 'username', 'password')

## Map the target route network from the feature service.Here, 18 corresponds to the target route network.
in_lrs_network = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/18"

# Process: Append Routes.
arcpy.locref.AppendRoutes(source_routes, in_lrs_network, route_id_field, route_name_field, from_date_field, to_date_field, line_id_field, line_name_field, line_order_field, field_mapping, load_type,load_field)

# Check in licenses
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