arcpy.locref.UpdateMeasuresFromLRS(lrs_network, lrs_date, in_features, route_id_field, from_measure_field, {to_measure_field}, {to_route_id_field}, {route_name_field}, {to_route_name_field}, {search_tolerance})
|
名称
|
说明
|
数据类型
|
|
lrs_network
|
包含路径、路径 ID、路径名称(如果已配置)和测量值的要素图层。
|
Feature Layer
|
|
lrs_date
|
定义网络时态视图的日期。
|
Date
|
|
in_features
|
点或线要素,将根据与 LRS 网络中的路径相关的要素几何对其进行更新。
|
Feature Layer
|
|
route_id_field
|
in_features 参数值中包含路径 ID 属性的字段。
该字段的数据类型和长度必须与 LRS 网络中相应字段的数据类型和长度相匹配。
|
Field
|
|
from_measure_field
|
in_features 参数值中包含点要素测量值或线要素起始测量值的字段。
该字段的数据类型和长度必须与 LRS 网络中相应字段的数据类型和长度相匹配。
|
Field
|
|
to_measure_field
(可选)
|
in_features 参数值中包含线要素终止测量值的字段。
该字段的数据类型和长度必须与 LRS 网络中相应字段的数据类型和长度相匹配。
|
Field
|
|
to_route_id_field
(可选)
|
in_features 参数值中包含路径 ID 属性的字段。
仅当 in_features 参数值为线要素图层时,此参数才可用。
该字段的数据类型和长度必须与 LRS 网络中相应字段的数据类型和长度相匹配。
|
Field
|
|
route_name_field
(可选)
|
in_features 参数值中包含路径名称属性的字段。
仅当 LRS 网络已配置路径名称时,此参数才可用。
该字段的数据类型和长度必须与 LRS 网络中相应字段的数据类型和长度相匹配。
|
Field
|
|
to_route_name_field
(可选)
|
in_features 参数值中包含路径止于名称属性的字段。
仅当 LRS 网络已配置路径名称并且 in_features 参数值为线要素图层时,此参数才可用。
该字段的数据类型和长度必须与 LRS 网络中相应字段的数据类型和长度相匹配。
|
Field
|
|
search_tolerance
(可选)
|
将标识输入要素搜索容差范围内的路径。 将使用搜索容差范围内最近路径的路径和测量值来更新输入要素。
搜索容差单位基于 LRS 网络的 x,y 单位。
|
Double
|
派生输出
|
名称
|
说明
|
数据类型
|
|
out_details_file
|
用于列出已更新输入要素的输出 .csv 文件。 此 .csv 文件包含路径 ID、路径名称(如果已配置)以及更新前后每个已更新要素的测量值属性。
|
File
|
|
out_features
|
更新的要素图层。
注:
此工具的验证结果将写入 ArcGIS Server 目录。 默认情况下,此文件会在 10 分钟内自动清除,这可能不足以处理所有验证并将其写入正在运行 ArcGIS Pro 的工作站。 对于较大的数据负载,建议您将最大文件期限调整为至少一小时。
|
Feature Layer
|
代码示例
UpdateMeasuresFromLRS 示例 1(Python 窗口)
此代码示例演示如何在 Python 窗口中使用 UpdateMeasuresFromLRS 函数。
# Name: UpdateMeasuresFromLRS_Sample1.py
# Description: This will populate the Route ID and measures in the input layer based on overlapping routes from the network layer.
# The output is the input layer with the updated Route ID and measure values, and a .csv file with information on the updated features and errors.
# Requires: ArcGIS Location Referencing
# Variables are supported from feature service only. Signing into 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, 8 corresponds to the lrs route network.
lrs_network_url = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/8"
lrs_network = arcpy.management.MakeFeatureLayer(lrs_network_url, "networkLayer")
# Map the input feature layer from the same feature service. Here, 18 corresponds to the input feature layer.
in_features_url = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/18"
in_features = arcpy.management.MakeFeatureLayer(in_features_url, "inputFeaturesLayer")
lrs_date = "10/8/2019"
route_id_field = "ROUTEID"
from_measure_field = "FROMMEASURE"
to_measure_field = "TOMEASURE"
to_route_id_field = None
route_name_field = None
to_route_name_field = None
search_tolerance = None
# Run the tool
arcpy.locref.UpdateMeasuresFromLRS(lrs_network, lrs_date, in_features, route_id_field, from_measure_field, to_measure_field, to_route_id_field, route_name_field, to_route_name_field, search_tolerance)
UpdateMeasuresFromLRS 示例 2(独立脚本)
此代码示例演示了如何在独立 Python 脚本中使用 UpdateMeasuresFromLRS 函数。
# Name: UpdateMeasuresFromLRS_Sample2.py
# Description: Populate the route ID and measures in the input layer based on overlapping routes from the network layer.
# The output is the input layer with the updated route ID and measure values, and a .csv file with information on the updated features and errors.
# Requires: ArcGIS Location Referencing
# Import arcpy module
import arcpy
# Variables are supported from feature service only. Portal signin is required to access the feature service.
arcpy.SignInToPortal('https://yourdomain.com/portal', 'username', 'password')
# Initialize variables
# Map the lrs network from the feature service. Here, 8 corresponds to the LRS route network.
lrs_network_url = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/8"
lrs_network = arcpy.management.MakeFeatureLayer(lrs_network_url, "networkLayer")
# Map the input feature layer from the same feature service. Here, 18 corresponds to the input feature layer.
in_features_url = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/18"
in_features = arcpy.management.MakeFeatureLayer(in_features_url, "inputFeaturesLayer")
lrs_date= "10/8/2019"
route_id_field = "ROUTEID"
from_measure_field = "FROMMEASURE"
to_measure_field = "TOMEASURE"
to_route_id_field = None
route_name_field = None
to_route_name_field = None
search_tolerance = None
# Run the tool
arcpy.locref.UpdateMeasuresFromLRS(lrs_network, lrs_date, in_features, route_id_field, from_measure_field, to_measure_field, to_route_id_field, route_name_field, to_route_name_field, search_tolerance)
UpdateMeasuresFromLRS 示例 3(Python 窗口)
此代码示例演示了如何针对跨越要素在 Python 窗口中使用 UpdateMeasuresFromLRS 函数。
# Name: UpdateMeasuresFromLRS_sample3.py
# Description: This will populate the Route ID, Route Name, and measures in the input layer based on overlapping routes from the network layer.
# The output is the input layer with the updated Route ID, Route Name and measure values, and a .csv file with information on the updated features and errors.
# Requires: ArcGIS Location Referencing
# Variables are supported from feature service only. Signing into 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, 8 corresponds to the lrs route network.
lrs_network_url = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/8"
lrs_network = arcpy.management.MakeFeatureLayer(lrs_network_url, "networkLayer")
# Map the input feature layer from the same feature service. Here, 18 corresponds to the input spannning feature layer.
in_features_url = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/18"
in_features = arcpy.management.MakeFeatureLayer(in_features_url, "inputFeaturesLayer")
lrs_date = "12/31/2024"
route_id_field = "ROUTEID"
from_measure_field = "FROMMEASURE"
to_measure_field = "TOMEASURE"
to_route_id_field = "TOROUTEID"
route_name_field = "RteName"
to_route_name_field = "ToRteName"
search_tolerance = None
# Run the tool
arcpy.locref.UpdateMeasuresFromLRS(lrs_network, lrs_date, in_features, route_id_field, from_measure_field, to_measure_field, to_route_id_field, route_name_field, to_route_name_field, search_tolerance)