Generate Linear Referenced Length Summary (Location Referencing)

Available with Location Referencing license.

Summary

Creates a length data product for routes in an LRS Network without an LRS data template.

Usage

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

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

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

  • The summary layer must be a polygon feature class, an LRS line event feature class that is registered to the specified LRS Network, or an LRS Network.

  • The length layer must be an LRS Network or an LRS line event feature class that is registered to the specified LRS Network.

  • The summary and length layers must be stored in the same geodatabase or feature service and have the same coordinate system as the specified LRS Network.

  • A value of unclassified will be included in the output summary field for routes that do not overlap with the summary layers.

  • You can add multiple summary fields.

  • The output will be created based on the intersection of selected features from the LRS Network, summary layers, and length layers.

  • You can add multiple length fields from the same feature class by creating selection layers and specifying each selection layer as a length field. For example, if you have an LRS line event feature class, you can create two selection layers—Class A and Class B—and specify each selection layer as a length field.

Parameters

LabelExplanationData Type
Input Route Features

The route features that will be used to calculate the LRS length data product.

Feature Layer
Effective Date

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

The default value is today's date.

Date
Length Units

Specifies the measure unit that will be used for the length fields in the output.

  • 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.
  • Feet (International)The units will be international feet.
  • Statute MilesThe units will be statute miles.
  • 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
Summary Fields
(Optional)

The fields from the layers that will be used to show the names for the summary rows in the output.

  • Layer—The feature layer that will be used as the summary layer.
  • Field—The field that will be used to summarize the length.
  • Output Field Name—The summary field's display name in the output.
Value Table
Length Fields
(Optional)

The fields from the layers that will be used to show the length of the routes in the output.

  • Layer—The feature layer that will be used as the basis for calculating the length.
  • Output Field Name—The length field’s display name in the output.
Value Table
Exclude null summary rows
(Optional)

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

  • Checked—Rows with a zero length (null summary rows) will be excluded from the output. This is the default.
  • Unchecked—Rows with a zero length (null summary rows) will not be excluded from the output.
Boolean
Calculate length for dominant routes
(Optional)
Note:

Support for this parameter will be added in a future release.

Boolean
Output Format
(Optional)

Specifies the format of the output.

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

The output .csv file that will contain the length data product.

File
Output Table
(Optional)

The output geodatabase table that will contain the length data product.

Table

arcpy.locref.GenerateLRLengthSummary(in_route_features, effective_date, units, {summary_fields}, {length_fields}, {exclude_null_summary_rows}, {calculate_length_for_dominant_routes}, {output_format}, {out_file}, {out_table})
NameExplanationData Type
in_route_features

The route features that will be used to calculate the LRS length data product.

Feature Layer
effective_date

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

The default value is today's date.

Date
units

Specifies the measure unit that will be used for the length fields 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.
  • INTFEETThe units will be international feet.
  • INTMILESThe units will be statute miles.
  • 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
summary_fields
[summary_fields,...]
(Optional)

The fields from the layers that will be used to show the names for the summary rows in the output.

  • Layer—The feature layer that will be used as the summary layer.
  • Field—The field that will be used to summarize the length.
  • Output Field Name—The summary field's display name in the output.
Value Table
length_fields
[length_fields,...]
(Optional)

The fields from the layers that will be used to show the length of the routes in the output.

  • Layer—The feature layer that will be used as the basis for calculating the length.
  • Output Field Name—The length field’s display name in the output.
Value Table
exclude_null_summary_rows
(Optional)

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

  • EXCLUDERows with a zero length (null summary rows) will be excluded from the output. This is the default.
  • DO_NOT_EXCLUDERows with a zero length (null summary rows) will not be excluded from the output.
Boolean
calculate_length_for_dominant_routes
(Optional)
Note:

Support for this parameter will be added in a future release.

Boolean
output_format
(Optional)

Specifies the format of the output.

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

The output .csv file that will contain the length data product.

File
out_table
(Optional)

The output geodatabase table that will contain the length data product.

Table

Code sample

GenerateLRLengthSummary example 1 (stand-alone script)

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

# Name: GenerateLRLengthSummary_ex1.py 
# Description: Create a length data product that provides the length of routes for three class types, summarized by counties with a population of more than 50,000
# Requirements: ArcGIS Location Referencing 
 
# Import arcpy module 
import arcpy 
 
# Check out any necessary licenses 
arcpy.CheckOutExtension("LocationReferencing")

# Set current workspace  
arcpy.env.workspace = r"C:\Data\SampleData.gdb" 

# Create a feature layer of counties that have more than 50,000 population, to be used as summary field
arcpy.management.MakeFeatureLayer("counties", "counties_50K", "POPULATION > 50000")

# Create 3 feature layers, each representing a class type, to be used as length fields
arcpy.management.MakeFeatureLayer("Class", "Class_A", "classtype = 1") 
arcpy.management.MakeFeatureLayer("Class", "Class_B", "classtype = 2")   
arcpy.management.MakeFeatureLayer("Class", "Class_C", "classtype = 3") 

# Set tool variables 
in_route_features = "Network" 
effective_date = "12/31/2024" 
units = "METERS" 
summary_fields = "counties_50K NAME Counties"
length_fields = "Class_A 'Class A'; Class_B 'Class B'; Class_C 'Class C'"
exclude_null_summary_rows = "EXCLUDE"
calculate_length_for_dominant_routes = None
output_format = "CSV" 
out_file = r"C:\Data\LP1.csv" 
out_table = None 

# Run the tool 
arcpy.locref.GenerateLRLengthSummary(in_route_features, effective_date, units, summary_fields, length_fields,
                                     exclude_null_summary_rows, calculate_length_for_dominant_routes,
                                     output_format, out_file, out_table) 

# Check in licenses 
arcpy.CheckInExtension("LocationReferencing")
GenerateLRLengthSummary example 2 (Python window)

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

# Name: GenerateLRLengthSummary_ex2.py 
# Description: Create a length data product that provides the length of routes for all class types, summarized by counties
# Requirements: ArcGIS Location Referencing 
 
# Set tool variables 
in_route_features = "Network" 
effective_date = "12/31/2024" 
units = "METERS" 
summary_fields = "Counties NAME Counties" 
length_fields = "'Class' 'Class'"  
exclude_null_summary_rows = "DO_NOT_EXCLUDE" 
calculate_length_for_dominant_routes = None 
output_format = "CSV" 
out_file = r"C:\Data\LP2.csv" 
out_table = None 
 
# Run the tool 
arcpy.locref.GenerateLRLengthSummary(in_route_features, effective_date, units, summary_fields, length_fields,
                                     exclude_null_summary_rows, calculate_length_for_dominant_routes,
                                     output_format, out_file, out_table)
GenerateLRLengthSummary example 3 (stand-alone script)

The following stand-alone script demonstrates how to use the GenerateLRLengthSummary function with data from a feature service.

# Name: GenerateLRLengthSummary_ex3.py 
# Description: Using LRS data in a feature service, create a length data product that provides the length of routes
# for three class types, summarized by counties with a population of more than 50,000
# Requires: ArcGIS Location Referencing 
 
# Import arcpy module 
import arcpy 
 
# Check out the license 
arcpy.CheckOutExtension("LocationReferencing") 
 
# Data is in a feature service. Signing in to the Enterprise 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 LRS Network's layer ID
in_route_features = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/1"

# Map the Counties layer from the feature service. Here, 39 corresponds to the Counties layer's layer ID
counties = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/39"

# Create a feature layer of counties that have more than 50,000 population, to be used as summary field 
arcpy.management.MakeFeatureLayer(counties, "counties_50K", "POPULATION > 50000")

# Map the Class layer from the feature service. Here, 22 corresponds to the Class layer's layer ID
classlayer = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/22"

# Create 3 feature layers, each representing a class type, to be used as length fields 
arcpy.management.MakeFeatureLayer(classlayer, "Class_A", "classtype = 1") 
arcpy.management.MakeFeatureLayer(classlayer, "Class_B", "classtype = 4")   
arcpy.management.MakeFeatureLayer(classlayer, "Class_C", "classtype = 7")

# Set tool variables 
effective_date = "12/31/2024" 
units = "METERS" 
summary_fields = "counties_50K NAME Counties" 
length_fields = "Class_A 'Class A'; Class_B 'Class B'; Class_C 'Class C'"
exclude_null_summary_rows = "EXCLUDE"
calculate_length_for_dominant_routes = None
output_format = "CSV" 
out_file = r"C:\Data\LP3.csv" 
out_table = None 
 
# Run the tool 
arcpy.locref.GenerateLRLengthSummary(in_route_features, effective_date, units, summary_fields, length_fields,
                                     exclude_null_summary_rows, calculate_length_for_dominant_routes,
                                     output_format, out_file, out_table) 
 
# Check in the 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