Update Measures From LRS (Location Referencing)

Available with Location Referencing license.

Summary

Populates or updates the route and measure attributes on any point or line features, including Utility Network features such as pipes, devices, and junctions, or LRS features such as events and intersections.

The attributes that will be updated include route ID, route name (if configured), and measures.

Usage

  • This tool supports data from a file geodatabase, an enterprise geodatabase (branch versioned connection), or a feature service (published from branch versioned data).

  • The spatial reference, x,y resolution, and x,y tolerance of the Input Features and LRS Network parameter values must match.

  • The To Route ID Field and To Route Name Field parameters are optional and are applicable for features that span routes.

  • The Search Tolerance parameter is used to update the route and measure attributes of the input features if they are not coincident with a route.

    • The nearest route's route and measure available within the search tolerance will be used to update the input features.
    • If two or more routes are equidistant from an input feature, any one of those routes will be used for the update.
    • If the input feature is a line feature, the route and measure attributes will be populated only when the start and end of the line feature are within the search tolerance of a route.
  • The following diagrams and tables show how point and line input features will be updated:

    Example of updating route ID and measures of a line feature

    Feature TypeRoute IDFrom MeasureTo MeasureComments

    Line

    Route1

    11

    17

    The line feature's geometry has a geometric match with Route1.

    Updated route and measure attributes in the input layer

    Example of updating route ID and measure of a point feature

    Feature TypeRoute IDMeasureComments

    Point

    Route1

    21

    The point feature is on Route1.

    Updated route and measure attributes in the input layer

    Example of updating route ID and measure of a point feature after providing a search tolerance

    Feature TypeRoute IDMeasureComments

    Point

    Route1

    21

    The point feature is not on Route1. By providing a search tolerance, the route and measure attributes are updated from the nearest route.

    Updated route and measure attributes in the input layer

    Example of updating features that span routes

    Feature TypeRoute IDRoute NameFrom MeasureTo Route IDTo Route NameTo MeasureComments

    Line

    Route1

    L1R1

    11

    Route2

    L1R2

    28

    The line feature's geometry has a geometric match with routes L1R1 and L1R2, which belong to the same line.

    Updated route and measure attributes in the input layer

Parameters

LabelExplanationData Type
LRS Network

The feature layer that contains the routes, route IDs, route names (if configured), and measures.

Feature Layer
LRS Date

The date that will be used to define the temporal view of the network.

Date
Input Features

The point or line features that will be updated based on feature geometry relative to the routes in the LRS Network.

Feature Layer
Route ID Field

The field in the Input Features parameter value that contains the route ID attribute.

The data type and length of the field must match those of the corresponding field in the LRS Network.

Field
Measure Field

The field in the Input Features parameter value that contains the measure value for point features or the start measure value for line features.

The data type and length of the field must match those of the corresponding field in the LRS Network.

Field
To Measure Field
(Optional)

The field in the Input Features parameter value that contains the end measure value for line features.

The data type and length of the field must match those of the corresponding field in the LRS Network.

Field
To Route ID Field
(Optional)

The field in the Input Features parameter value that contains the to route ID attribute.

This parameter is only available when the Input Features parameter value is a line feature layer.

The data type and length of the field must match those of the corresponding field in the LRS Network.

Field
Route Name Field
(Optional)

The field in the Input Features parameter value that contains the route name attribute.

This parameter is only available when the LRS Network has a route name configured.

The data type and length of the field must match those of the corresponding field in the LRS Network.

Field
To Route Name Field
(Optional)

The field in the Input Features parameter value that contains the to route name attribute.

This parameter is only available when the LRS Network has a route name configured and the Input Features parameter value is a line feature layer.

The data type and length of the field must match those of the corresponding field in the LRS Network.

Field
Search Tolerance
(Optional)

The routes that are within the search tolerance of the input feature will be identified. The nearest route's route and measure available within the search tolerance will be used to update the input features.

The search tolerance unit is based on the x,y unit of the LRS Network.

Double

Derived Output

LabelExplanationData Type
Output Details File

The output .csv file that lists the updated input features. This .csv file includes the route ID, route name (if configured), and measure attributes of each updated feature before and after the update.

File
Out Features

The updated feature layer.

Note:

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 your workstation that is running ArcGIS Pro. For larger data loads, it is recommended that you adjust the maximum file age to at least one hour.

Feature Layer

arcpy.locref.UpdateMeasuresFromLRS(lrs_network, lrs_date, in_features, route_id_field, from_measure_field, {to_measure_field}, {to_route_id_field}, {route_name_field}, {to_route_name_field}, {search_tolerance})
NameExplanationData Type
lrs_network

The feature layer that contains the routes, route IDs, route names (if configured), and measures.

Feature Layer
lrs_date

The date that will be used to define the temporal view of the network.

Date
in_features

The point or line features that will be updated based on feature geometry relative to the routes in the LRS Network.

Feature Layer
route_id_field

The field in the in_features parameter value that contains the route ID attribute.

The data type and length of the field must match those of the corresponding field in the LRS Network.

Field
from_measure_field

The field in the in_features parameter value that contains the measure value for point features or the start measure value for line features.

The data type and length of the field must match those of the corresponding field in the LRS Network.

Field
to_measure_field
(Optional)

The field in the in_features parameter value that contains the end measure value for line features.

The data type and length of the field must match those of the corresponding field in the LRS Network.

Field
to_route_id_field
(Optional)

The field in the in_features parameter value that contains the route ID attribute.

This parameter is only available when the in_features parameter value is a line feature layer.

The data type and length of the field must match those of the corresponding field in the LRS Network.

Field
route_name_field
(Optional)

The field in the in_features parameter value that contains the route name attribute.

This parameter is only available when the LRS Network has a route name configured.

The data type and length of the field must match those of the corresponding field in the LRS Network.

Field
to_route_name_field
(Optional)

The field in the in_features parameter value that contains the to route name attribute.

This parameter is only available when the LRS Network has a route name configured and the in_features parameter value is a line feature layer.

The data type and length of the field must match those of the corresponding field in the LRS Network.

Field
search_tolerance
(Optional)

The routes that are within the search tolerance of the input feature will be identified. The nearest route's route and measure available within the search tolerance will be used to update the input features.

The search tolerance unit is based on the x,y unit of the LRS Network.

Double

Derived Output

NameExplanationData Type
out_details_file

The output .csv file that lists the updated input features. This .csv file includes the route ID, route name (if configured), and measure attributes of each updated feature before and after the update.

File
out_features

The updated feature layer.

Note:

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 your workstation that is running ArcGIS Pro. For larger data loads, it is recommended that you adjust the maximum file age to at least one hour.

Feature Layer

Code sample

UpdateMeasuresFromLRS example 1 (Python window)

This code sample demonstrates how to use the UpdateMeasuresFromLRS function in the Python window.

# Name: UpdateMeasuresFromLRS_Sample1.py
# Description: This will populate the Route ID and measures in the input layer based on overlapping routes from the network layer. 
# The output is the input layer with the updated Route ID and measure values, and a .csv file with information on the updated features and errors.
# Requires: ArcGIS Location Referencing

# Variables are supported from feature service only. Signing into Portal is required to access the feature service.
arcpy.SignInToPortal('https://yourdomain.com/portal', 'username', 'password')

# Map the lrs network from the feature service. Here, 8 corresponds to the lrs route network.
lrs_network_url =  r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/8"
lrs_network = arcpy.management.MakeFeatureLayer(lrs_network_url, "networkLayer")

# Map the input feature layer from the same feature service. Here, 18 corresponds to the input feature layer.
in_features_url = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/18"
in_features = arcpy.management.MakeFeatureLayer(in_features_url, "inputFeaturesLayer")
lrs_date = "10/8/2019"
route_id_field = "ROUTEID"
from_measure_field = "FROMMEASURE"
to_measure_field = "TOMEASURE"
to_route_id_field = None
route_name_field = None
to_route_name_field = None
search_tolerance = None

# Execute the tool
arcpy.locref.UpdateMeasuresFromLRS(lrs_network, lrs_date, in_features, route_id_field, from_measure_field, to_measure_field, to_route_id_field, route_name_field, to_route_name_field, search_tolerance)
UpdateMeasuresFromLRS example 2 (stand-alone script)

This code sample demonstrates how to use the UpdateMeasuresFromLRS function in a stand-alone Python script.

# Name: UpdateMeasuresFromLRS_Sample2.py
# Description: Populate the route ID and measures in the input layer based on overlapping routes from the network layer. 
# The output is the input layer with the updated route ID and measure values, and a .csv file with information on the updated features and errors.
# Requires: ArcGIS Location Referencing
 
# Import arcpy module
import arcpy
 
# Check out license
arcpy.CheckOutExtension("LocationReferencing")

# Variables are supported from feature service only. Portal signin is required to access the feature service.
arcpy.SignInToPortal('https://yourdomain.com/portal', 'username', 'password')

# Initialize variables
# Map the lrs network from the feature service. Here, 8 corresponds to the LRS route network.
lrs_network_url =  r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/8"
lrs_network = arcpy.management.MakeFeatureLayer(lrs_network_url, "networkLayer")

# Map the input feature layer from the same feature service. Here, 18 corresponds to the input feature layer.
in_features_url = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/18"
in_features = arcpy.management.MakeFeatureLayer(in_features_url, "inputFeaturesLayer")
lrs_date= "10/8/2019"
route_id_field = "ROUTEID"
from_measure_field = "FROMMEASURE"
to_measure_field = "TOMEASURE"
to_route_id_field = None
route_name_field = None
to_route_name_field = None
search_tolerance = None

# Execute the tool
arcpy.locref.UpdateMeasuresFromLRS(lrs_network, lrs_date, in_features, route_id_field, from_measure_field, to_measure_field, to_route_id_field, route_name_field, to_route_name_field, search_tolerance)

# Check in license
arcpy.CheckInExtension("LocationReferencing")
UpdateMeasuresFromLRS example 3 (Python window)

This code sample demonstrates how to use the UpdateMeasuresFromLRS function in the Python window for spanning features.

# Name: UpdateMeasuresFromLRS_sample3.py
# Description: This will populate the Route ID, Route Name, and measures in the input layer based on overlapping routes from the network layer. 
# The output is the input layer with the updated Route ID, Route Name and measure values, and a .csv file with information on the updated features and errors.
# Requires: ArcGIS Location Referencing

# Variables are supported from feature service only. Signing into Portal is required to access the feature service.
arcpy.SignInToPortal('https://yourdomain.com/portal', 'username', 'password')

# Map the lrs network from the feature service. Here, 8 corresponds to the lrs route network.
lrs_network_url =  r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/8"
lrs_network = arcpy.management.MakeFeatureLayer(lrs_network_url, "networkLayer")

# Map the input feature layer from the same feature service. Here, 18 corresponds to the input spannning feature layer.
in_features_url = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/18"
in_features = arcpy.management.MakeFeatureLayer(in_features_url, "inputFeaturesLayer")
lrs_date = "12/31/2024"
route_id_field = "ROUTEID"
from_measure_field = "FROMMEASURE"
to_measure_field = "TOMEASURE"
to_route_id_field = "TOROUTEID"
route_name_field = "RteName"
to_route_name_field = "ToRteName"
search_tolerance = None

# Execute the tool
arcpy.locref.UpdateMeasuresFromLRS(lrs_network, lrs_date, in_features, route_id_field, from_measure_field, to_measure_field, to_route_id_field, route_name_field, to_route_name_field, search_tolerance)

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