| Label | Explanation | Data 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.
| String |
Summary Fields (Optional) | The fields from the layers that will be used to show the names for the summary rows 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.
| Value Table |
Exclude null summary rows (Optional) | Specifies whether null summary rows will 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.
| 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 |
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
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})| Name | Explanation | Data 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.
| 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.
| 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.
| Value Table |
exclude_null_summary_rows (Optional) | Specifies whether null summary rows will 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.
| 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
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")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)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)