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 other non-UN or non-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 non-LRS feature class.
Note:
The ArcGIS Pipeline Referencing Server extension is required to use this tool.
Usage
The input layer and LRS Network parameter layer must be from an LRS-enabled feature service.
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 must be exactly coincident to the LRS Network features.
The following diagrams and tables demonstrate how line and point features from the non-LRS Input Features that are coincident to Route1 in the LRS Network will be updated:
Input Layer Feature Type Route ID From Measure To Measure Comments Non-LRS input layer
Line
Route1
11
18
The line feature's geometry has a geometric match with the LRS network.
Input Layer Feature Type Route ID From Measure To Measure Comments Non-LRS input layer
Point
Route1
21
The point feature is coincident with the route on the LRS Network.
Input Layer Feature Type Route ID From Measure To Measure Comments Non-LRS input layer
Line
The line feature's geometry is not coincident with the input network. No information is returned.
Syntax
arcpy.locref.UpdateMeasuresFromLRS(lrs_network, lrs_date, in_features, route_id_field, from_measure_field, {to_measure_field})
Parameter | Explanation | Data Type |
lrs_network | The feature service 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 Input Features layer that contains the route ID value. | Field |
from_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
Name | Explanation | Data Type |
out_details_file | The output log file that lists the updated features in the Input Layer. 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 service 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
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
# Check out license
arcpy.CheckOutExtension("LocationReferencing")
## 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')
# 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.MakeFeatureLayer_management(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.MakeFeatureLayer_management(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')
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.MakeFeatureLayer_management(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.MakeFeatureLayer_management(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
Licensing information
- Basic: Requires ArcGIS Location Referencing
- Standard: Requires ArcGIS Location Referencing
- Advanced: Requires ArcGIS Location Referencing