Update Measures From LRS (Location Referencing)

Available with Location Referencing license.

Summary

Populates or updates the measures and route ID on Utility Network (UN) features such as pipes, devices, and junctions or on features in feature classes that are not UN or LRS feature classes.

This tool finds appropriate routes from the LRS Network parameter, gets the measures from that route, and populates or updates the measure and route attributes for the features in the nonLRS feature class.

Note:

The ArcGIS Pipeline Referencing or ArcGIS Roads and Highways extension is required to use this tool when using datasets from a feature service.

Usage

  • As of ArcGIS Pro 3.1, this tool supports direct connection (client and server connection) using branch versioning as well as previously supported connection through a feature service using branch versioning.

  • The field properties of the Input Features and LRS Network parameters must match.

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

  • A text log is written locally that states that the tool was executed and contains the following:

    • Information on any input features that failed validation
    • The route ID and measure values for the updated input features from before and after the update

  • The Input Features value must be exactly coincident to the LRS Network features.

    The following diagrams and tables show how line and point features from the Input Features values that are not LRS features classes but are coincident to Route1 in the LRS Network features will be updated:

    Example of updating route ID measures using a line feature

    Input LayerFeature TypeRoute IDFrom MeasureTo MeasureComments

    NonLRS input layer

    Line

    Route1

    11

    18

    The line feature's geometry has a geometric match with the LRS network.

    Example of updating route ID measures using a point feature

    Input LayerFeature TypeRoute IDFrom MeasureTo MeasureComments

    NonLRS input layer

    Point

    Route1

    21

    The point feature is coincident with the route on the LRS Network value.

    Example of route ID measures that can't be updated because the line feature is not exactly coincident to the LRS network

    Input LayerFeature TypeRoute IDFrom MeasureTo MeasureComments

    NonLRS input layer

    Line

    The line feature's geometry is not coincident with the input network. No information is returned.

Parameters

LabelExplanationData Type
LRS Network

The feature layer that contains the routes, route IDs, and measures.

Feature Layer
LRS Date

The date used to define the temporal view of the network for collecting the route and measure values.

Date
Input Features

The layer that includes route ID and measure fields that will be updated based on feature geometry relative to routes in the LRS Network parameter.

Feature Layer
Route ID Field

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

Field
Measure Field

The field in the Input Features layer that contains the from measure value for polyline features.

Field
To Measure Field
(Optional)

The field in the Input Features layer that contains the measure value for point features or the to measure value for polyline features.

Field

Derived Output

LabelExplanationData Type
Output Details File

The output log file that lists the updated features from the Input Features parameter. This log file will include the before and after values for the route ID, from measure, and to measure fields for each updated feature.

Text 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})
NameExplanationData Type
lrs_network

The feature layer that contains the routes, route IDs, and measures.

Feature Layer
lrs_date

The date used to define the temporal view of the network for collecting the route and measure values.

Date
in_features

The layer that includes route ID and measure fields that will be updated based on feature geometry relative to routes in the lrs_network parameter.

Feature Layer
route_id_field

The field in the in_features layer that contains the route ID value.

Field
from_measure_field

The field in the in_features layer that contains the from measure value for polyline features.

Field
to_measure_field
(Optional)

The field in the in_features layer that contains the measure value for point features or the to measure value for polyline features.

Field

Derived Output

NameExplanationData Type
out_details_file

The output log file that lists the updated features from the in_features parameter. This log file will include the before and after values for the route ID, from measure, and to measure fields for each updated feature.

Text 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 example1 (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"

# Execute the tool
arcpy.locref.UpdateMeasuresFromLRS(lrs_network, lrs_date, in_features, route_id_field, from_measure_field, to_measure_field)
UpdateMeasuresFromLRS example2 (stand-alone script)

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

# 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"

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

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

Environments

This tool does not use any geoprocessing 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