Generate LRS Data Product (Location Referencing)

Available with Location Referencing license.

Summary

Transforms LRS data to create a length product for selected routes in an LRS Network. For example, use this tool to summarize the mileage of a set of routes or lines by a county boundary.

Usage

  • Use an LRS Data template that specifies the summary and length fields. You can use a location referencing template for pipelines or roads and highways.

  • The summary and length fields must exist in the same geodatabase as the LRS Network layer.

  • The template must be a .json file.

  • Use a network feature class for the Input Route Features parameter value.

  • This tool does not modify the inputs and will create a .csv file as the output.

  • This tool supports selection and definition query.

  • The Effective Date parameter is used to define the temporal view of the network. Only routes active on this date will be used for calculating the output.

  • This tool supports unit conversion when converting from the network's measure units to another unit.

  • The Boundary Features and Summary Field parameters are only valid when no summary field is provided in the .json file.

  • If the network has routes with calibration issues or with a length of zero, check the Exclude Null Summary Rows parameter to exclude those routes from the output. Otherwise, those routes will be included in the output with a length of zero.

Parameters

LabelExplanationData Type
Template

The input LRS Data template that specifies the summary and length fields.

File
Input Route Features

The LRS Network that will be used to calculate the length.

Feature Layer
Effective Date

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

Date
Length Units

Specifies the measurement units that will be used for the length field in the output.

  • InchesThe units will be inches.
  • FeetThe units will be feet.
  • YardsThe units will be yards.
  • MilesThe units will be miles.
  • Nautical MilesThe units will be nautical miles.
  • International MilesThe units will be international miles.
  • International FeetThe units will be international feet.
  • MillimetersThe units will be millimeters.
  • CentimetersThe units will be centimeters.
  • MetersThe units will be meters.
  • KilometersThe units will be kilometers.
  • DecimetersThe units will be decimeters.
String
Boundary Features
(Optional)

The boundary layer that will be used to summarize the data.

Feature Layer
Summary Field
(Optional)

The field from the boundary layer that provides the names for the summary rows.

Field
Exclude null summary rows
(Optional)

Specifies whether null summary rows will be excluded from the output.

  • Checked—Uncalibrated routes or routes with zero length will be excluded from the output. This is the default.
  • Unchecked—Uncalibrated routes or routes with zero length will not be excluded from the output; they will be included in the output with a mileage of 0.
Boolean
Output Format
(Optional)

Specifies the format of the output file.

  • CSVThe output file will be a .csv file. This is the default.
String
Output File
(Optional)

The output .csv file where the calculated length will be written.

File
Output Table
(Optional)

The table that will be created with the calculated length.

Table

arcpy.locref.GenerateLrsDataProduct(in_template, in_route_features, effective_date, units, {boundary_features}, {summary_field}, {exclude_null_summary_rows}, {output_format}, {out_file}, {out_table})
NameExplanationData Type
in_template

The input LRS Data template that specifies the summary and length fields.

File
in_route_features

The LRS Network that will be used to calculate the length.

Feature Layer
effective_date

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

Date
units

Specifies the measurement units that will be used for the length field in the output.

  • INCHESThe units will be inches.
  • FEETThe units will be feet.
  • YARDSThe units will be yards.
  • MILESThe units will be miles.
  • NAUTICAL_MILESThe units will be nautical miles.
  • INTMILESThe units will be international miles.
  • INTFEETThe units will be international feet.
  • MILLIMETERSThe units will be millimeters.
  • CENTIMETERSThe units will be centimeters.
  • METERSThe units will be meters.
  • KILOMETERSThe units will be kilometers.
  • DECIMETERSThe units will be decimeters.
String
boundary_features
(Optional)

The boundary layer that will be used to summarize the data.

Feature Layer
summary_field
(Optional)

The field from the boundary layer that provides the names for the summary rows.

Field
exclude_null_summary_rows
(Optional)

Specifies whether null summary rows will be excluded from the output.

  • EXCLUDEUncalibrated routes or routes with zero length will be excluded from the output. This is the default.
  • DO_NOT_EXCLUDEUncalibrated routes or routes with zero length will not be excluded from the output; they will be included in the output with a mileage of 0.
Boolean
output_format
(Optional)

Specifies the format of the output file.

  • CSVThe output file will be a .csv file. This is the default.
String
out_file
(Optional)

The output .csv file where the calculated length will be written.

File
out_table
(Optional)

The table that will be created with the calculated length.

Table

Code sample

GenerateLrsDataProduct example 1 (stand-alone script)

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

# Name: GenerateLrsDataProduct_ex1.py
# Description: Transforms LRS data to create a Length product for the selected routes in an LRS Network in a stand-alone script.
# Requirements: ArcGIS Location Referencing

# Import arcpy module
import arcpy

# Check out any necessary licenses
arcpy.CheckOutExtension("LocationReferencing")

# Local tool variables
in_template=r"C:\Data\Template.json"
in_route_features=r"C:\Data\SampleData.gdb\LRS\Network"
effective_date="06/03/2024"
units="METERS"
boundary_features = None
summary_field = None
exclude_null_summary_rows="EXCLUDE"
output_format="CSV"
out_file= r"C:\Data\LP1.csv"
out_table=None

# Run the tool
arcpy.locref.GenerateLrsDataProduct(in_template, in_route_features, effective_date, units, boundary_features, summary_field, exclude_null_summary_rows, output_format, out_file, out_table)

# Check in licenses
arcpy.CheckInExtension('LocationReferencing')
GenerateLrsDataProduct example 2 (Python window)

The following script demonstrates how to use the GenerateLrsDataProduct function in the Python window.

# Name: GenerateLrsDataProduct_ex2.py
# Description: Transforms LRS data to create a Length product for the selected routes in an LRS Network in the inline Python window in ArcGIS Pro.
# Requirements: ArcGIS Location Referencing

# Local tool variables
in_template=r"C:\Data\Template.json"
in_route_features=r"C:\Data\SampleData.gdb\LRS\Network"
effective_date="06/03/2024"
units="METERS"
boundary_features = None
summary_field = None
exclude_null_summary_rows="DO_NOT_EXCLUDE"
output_format="CSV"
out_file= r"C:\Data\LP2.csv"
out_table=None

# Run the tool
arcpy.locref.GenerateLrsDataProduct(in_template, in_route_features, effective_date, units, boundary_features, summary_field, exclude_null_summary_rows, output_format, out_file, out_table)
GenerateLrsDataProduct example 3 (stand-alone script)

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

# Name: GenerateLrsDataProduct_Ex3.py
# Description: Transforms LRS data to create a Length product for the selected routes using a feature service.
# Requires: ArcGIS Location Referencing

# Import arcpy module.
import arcpy

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

# Input event and target LRS network are in feature service.  Signing in 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, 1 corresponds to the target LRS Network's layer ID.
in_route_features = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/1"

# Set tool variables
in_template=r"C:\Data\Template.json"
effective_date="06/03/2024"
units="FEET"
boundary_features = None
summary_field = None
exclude_null_summary_rows="EXCLUDE"
output_format="CSV"
out_file= r"C:\Data\LP3.csv"
out_table=None

# Run the tool
arcpy.locref.GenerateLrsDataProduct (in_template, in_route_features, effective_date, units, boundary_features, summary_field, exclude_null_summary_rows, output_format, out_file, out_table)

# 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