Generate LRS Data Product (Location Referencing)

Available with Location Referencing license.

Summary

Transforms LRS data to create a length, route log, or feature count data product for selected routes in an LRS Network.

Usage

  • The template must be a .json file.

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

  • This tool does not modify the inputs and will create a .csv file or a geodatabase table 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.

  • When creating a length data product consider the following:

    • 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.
    • Unit conversion is supported 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.

  • When creating a route log data product consider the following:

    • Use an LRS data template that specifies the log, location, and referent fields. You can use a location referencing template for pipelines or roads and highways.
    • The log layer and fields must exist in the same geodatabase as the LRS Network layer.
    • The location layer and fields must be a polygon layer and exist in the same geodatabase as the LRS Network layer.
    • The referent layer and fields must be an LRS point event feature class and exist in the same geodatabase as the LRS Network layer.

  • When creating a feature count data product consider the following:

    • Use an LRS data template that specifies the count, summary, and route identifier fields. You can use a location referencing template for pipelines or roads and highways.
    • The count, summary, and route identifier fields must exist in the same geodatabase as the LRS Network layer.
    • The Boundary Features and Summary Field parameters are only valid when no summary field is provided in the .json file.

Parameters

LabelExplanationData Type
Template

The input LRS data template that specifies the summary and length fields (length data product); route identifier, log, location, and referent fields (route log data product); or count, summary, and route identifier fields (feature count data product).

File
Input Route Features

The LRS Network that will be used to calculate the length, route log, or feature count.

Feature Layer
Effective Date

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

Date
Length Units
(Optional)

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

This parameter is only available when creating a length data product.

  • Inches (US Survey)The units will be inches.
  • Feet (US Survey)The units will be feet.
  • Yards (US Survey)The units will be yards.
  • Miles (US Survey)The units will be miles.
  • Nautical Miles (US Survey)The units will be nautical miles.
  • Statute MilesThe units will be statute miles.
  • Feet (International)The 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.

This parameter is only available when creating a length or feature count data product.

Feature Layer
Summary Field
(Optional)

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

This parameter is only available when creating a length or feature count data product.

Field
Exclude null summary rows
(Optional)

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

  • Checked—Rows with a zero length or feature count will be excluded from the output. This is the default.
  • Unchecked—Rows with a zero length or feature count will not be excluded from the output.

This parameter is only available when creating a length or feature count data product.

Boolean
Output Format
(Optional)

Specifies the format of the output file.

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

The output .csv file where the calculated length, route log, or feature count will be written.

File
Output Table
(Optional)

The geodatabase table that will be created with the calculated length, route log, or feature count.

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 (length data product); route identifier, log, location, and referent fields (route log data product); or count, summary, and route identifier fields (feature count data product).

File
in_route_features

The LRS Network that will be used to calculate the length, route log, or feature count.

Feature Layer
effective_date

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

Date
units
(Optional)

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

This parameter is only available when creating a length data product.

  • 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 statute 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.

This parameter is only available when creating a length or feature count data product.

Feature Layer
summary_field
(Optional)

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

This parameter is only available when creating a length or feature count data product.

Field
exclude_null_summary_rows
(Optional)

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

  • EXCLUDERows with a zero length or feature count will be excluded from the output. This is the default.
  • DO_NOT_EXCLUDERows with a zero length or feature count will not be excluded from the output.

This parameter is only available when creating a length or feature count data product.

Boolean
output_format
(Optional)

Specifies the format of the output file.

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

The output .csv file where the calculated length, route log, or feature count will be written.

File
out_table
(Optional)

The geodatabase table that will be created with the calculated length, route log, or feature count.

Table

Code sample

GenerateLrsDataProduct example 1 (stand-alone script)

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

# Name: GenerateLrsDataProduct_ex1.py
# Description: Transforms LRS data to create a data 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 = "12/31/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 data 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 = "12/31/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 with data from a feature service.

# Name: GenerateLrsDataProduct_Ex3.py
# Description: Transforms LRS data to create a data 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 = "12/31/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