arcpy.locref.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})
|
名称
|
说明
|
数据类型
|
|
in_route_features
|
用于生成路径日志的路径要素。
|
Feature Layer
|
|
effective_date
|
定义网络时态视图的日期。
默认值为当前日期。
|
Date
|
|
log_fields
[log_fields,...]
(可选)
|
用于展示输出中的事件和相交信息的字段。
值表列:
|
Value Table
|
|
merge_coincident_events
(可选)
|
指定是否将重合线事件合并到输出中。
|
Boolean
|
|
location_fields
[location_fields,...]
(可选)
|
此字段用于展示路径穿过的面边界的属性。
值表列:
|
Value Table
|
|
referent_location
(可选)
|
指定用于计算引用偏移的方法。
|
String
|
|
referent_features
(可选)
|
要素图层用于计算路径日志条目的偏移。
|
Feature Layer
|
|
referent_field
(可选)
|
引用字段包含输出中引用要素的属性。
|
Field
|
|
offset_units
(可选)
|
指定用于计算引用要素和路径日志条目之间的距离的偏移单位。
|
String
|
|
output_format
(可选)
|
指定输出的格式。
|
String
|
|
out_file
(可选)
|
输出 .csv 文件将包含路径日志。
|
File
|
|
out_table
(可选)
|
将包含路径日志的输出地理数据库表。
|
Table
|
代码示例
GenerateLRRouteLog 示例 1(Python 窗口)
以下脚本演示了如何在 Python 窗口中使用 GenerateLRRouteLog 函数。
# 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 Location 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.locref.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 示例 2(独立脚本)
以下独立脚本演示了如何使用 GenerateLRRouteLog 函数。
# 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 Location 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.locref.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 示例 3(独立脚本)
以下独立脚本演示了如何将 GenerateLRRouteLog 函数与要素服务中的数据配合使用。
# 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 Location 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.locref.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)