arcpy.lr.GenerateLRRouteLog(in_route_features, effective_date, {log_fields}, {merge_coincident_events}, {location_fields}, {referent_location}, {referent_features}, {referent_field}, {offset_units}, {output_format}, {out_file}, {out_table})
|
Name
|
Explanation
|
Data type
|
|
in_route_features
|
The route features that will be used to generate the route log.
|
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
|
|
log_fields
[log_fields,...]
(Optional)
|
The fields that will be used to show event and intersection information in the output.
Value table columns:
|
Value Table
|
|
merge_coincident_events
(Optional)
|
Specifies whether coincident line events will be merged in the output.
MERGE—Coincident line events with the same value in the log field will be merged and returned as a single event.
DO_NOT_MERGE—Coincident line events with the same value in the log field will not be merged or returned as a single event. This is the default.
|
Boolean
|
|
location_fields
[location_fields,...]
(Optional)
|
The fields used to show the attributes of the polygon boundaries crossed by the routes.
Value table columns:
|
Value Table
|
|
referent_location
(Optional)
|
Specifies the method that will be used to calculate the referent offset.
NONE—The referent offset will not be calculated. This is the default.
NEAREST_UPSTREAM—The nearest referent feature upstream of the route log entry will be used to calculate the referent offset. If no upstream referent feature exists, the referent values will be empty.
NEAREST—The nearest referent feature, upstream or downstream of the route log entry, will be used to calculate the referent offset.
|
String
|
|
referent_features
(Optional)
|
The feature layer that will be used to calculate the offset from the route log entry.
|
Feature Layer
|
|
referent_field
(Optional)
|
The referent field that will contain the attributes of the referent features in the output.
|
Field
|
|
offset_units
(Optional)
|
Specifies the offset units that will be used to calculate the distance between the referent feature and the route log entry.
INCHES—The units will be inches.
FEET—The units will be feet.
YARDS—The units will be yards.
MILES—The units will be miles.
NAUTICAL_MILES—The units will be nautical miles.
INTFEET—The units will be international feet. This is the default.
INTMILES—The units will be statute miles.
MILLIMETERS—The units will be millimeters.
CENTIMETERS—The units will be centimeters.
METERS—The units will be meters.
KILOMETERS—The units will be kilometers.
DECIMETERS—The units will be decimeters.
|
String
|
|
output_format
(Optional)
|
Specifies the format of the output.
|
String
|
|
out_file
(Optional)
|
The output .csv file that will contain the route log.
|
File
|
|
out_table
(Optional)
|
The output geodatabase table that will contain the route log.
|
Table
|
Code sample
GenerateLRRouteLog example 1 (Python window)
The following script demonstrates how to use the GenerateLRRouteLog function in the Python window.
# Name: GenerateLRRouteLog_ex1.py
# Description: Create a route log data product that returns the location and information of signal events,
# functional class events, reference posts, intersections, and county boundaries for routes in an LRS Network
# Requirements: ArcGIS Linear Referencing
# Set tool variables
in_route_features = "CountyLog"
effective_date = "12/31/2024"
log_fields = "Signal SIGNAL_MODE; Functional_Class FUNCTIONAL_CLASS; Intersections IntersectionName"
merge_coincident_events = "DO_NOT_MERGE"
location_fields = "Counties NAME"
referent_location = "NEAREST_UPSTREAM"
referent_features = "Reference_Post"
referent_field = "POST_NAME"
offset_units = "INTFEET"
output_format = "TABLE"
out_file = None
out_table = r"C:\Data\SampleData.gdb\RL1"
# Run the tool
arcpy.lr.GenerateLRRouteLog(in_route_features, effective_date, log_fields, merge_coincident_events,
location_fields, referent_location, referent_features, referent_field,
offset_units, output_format, out_file, out_table)
GenerateLRRouteLog example 2 (stand-alone script)
The following stand-alone script demonstrates how to use the GenerateLRRouteLog function.
# Name: GenerateLRRouteLog_ex2.py
# Description: For routes in an LRS Network, create a route log data product that returns the location and information of anomalies, pipes, crossing utility intersections, operating pressure,
# ILI surveys, as well as county and city boundaries
# Requirements: ArcGIS Linear Referencing
# Import arcpy module
import arcpy
# Set current workspace
arcpy.env.workspace = r"C:\Data\SampleData.gdb"
# Using the Anomaly point event feature class, create a feature layer that contains active anomalies, to be used as a log layer
arcpy.management.MakeFeatureLayer("Anomaly", "Anomaly_Active", "anomalystatus = 'Active'")
# Using the Pipes line event feature class, create three feature layers, each representing a different pipe material, to be used as log layers
arcpy.management.MakeFeatureLayer("Pipes", "Pipes_CastIron", "MATERIAL = 2")
arcpy.management.MakeFeatureLayer("Pipes", "Pipes_Copper", "MATERIAL = 4")
arcpy.management.MakeFeatureLayer("Pipes", "Pipes_Composite", "MATERIAL = 10")
# Set tool variables
in_route_features = "Engineering Network"
effective_date = "12/31/2024"
log_fields = "Anomaly_Active anomalytype; Crossing Utility Intersection intersectionname; Pipes_CastIron status; Pipes_Copper status; Pipes_Composite status; Operating Pressure pressurevalue"
merge_coincident_events = "DO_NOT_MERGE"
location_fields = "Counties NAME; Cities CITY_NM"
referent_location = "NEAREST_UPSTREAM"
referent_features = "ILI Survey Readings"
referent_field = "surveytype"
offset_units = "INTFEET"
output_format = "TABLE"
out_file = None
out_table = r"C:\Data\SampleData.gdb\RL2"
# Run the tool
arcpy.lr.GenerateLRRouteLog(in_route_features, effective_date, log_fields, merge_coincident_events,
location_fields, referent_location, referent_features, referent_field,
offset_units, output_format, out_file, out_table)
GenerateLRRouteLog example 3 (stand-alone script)
The following stand-alone script demonstrates how to use the GenerateLRRouteLog function with data from a feature service.
# Name: GenerateLRRouteLog_ex3.py
# Description: Create a route log data product that returns the location and information of crashes, speed limits, pavement conditions,
# centerlines, intersections, and city boundaries for routes in a combined LRS and Address Data Management dataset that is published as a feature service
# Requires: ArcGIS Linear Referencing
# Import arcpy module
import arcpy
# 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, 11 corresponds to the LRS Network's layer ID
in_route_features = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/11"
# Create the feature layers from the feature service. The feature layers will be used as log layers
arcpy.management.MakeFeatureLayer(r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/25", "crash")
arcpy.management.MakeFeatureLayer(r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/24", "intersections")
arcpy.management.MakeFeatureLayer(r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/17", "speed_limit")
arcpy.management.MakeFeatureLayer(r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/14", "pavement_condition")
arcpy.management.MakeFeatureLayer(r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/19", "centerline")
# Create a feature layer from the Cities layer of the feature service to be used as the location layer
arcpy.management.MakeFeatureLayer(r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/21", "cities")
# Map the Reference Post layer from the feature service to be used as the input to the referent_features parameter
referent_features = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/26"
# Set tool variables
effective_date = "12/31/2024"
log_fields = "crash CrashType; intersections IntersectionName; speed_limit SpeedLimit; pavement_condition Condition; centerline fullname"
merge_coincident_events = "MERGE"
location_fields = "cities name"
referent_location = "NEAREST"
referent_field = "PostName"
offset_units = "INTFEET"
output_format = "CSV"
out_file = r"C:\Data\RL3.csv"
out_table = None
# Run the tool
arcpy.lr.GenerateLRRouteLog(in_route_features, effective_date, log_fields, merge_coincident_events,
location_fields, referent_location, referent_features, referent_field,
offset_units, output_format, out_file, out_table)