arcpy.locref.GenerateLrsDataProduct(in_template, in_route_features, effective_date, {units}, {boundary_features}, {summary_field}, {exclude_null_summary_rows}, {output_format}, {out_file}, {out_table})
|
名称
|
说明
|
数据类型
|
|
in_template
|
输入 LRS 数据模板,用于指定摘要和长度字段(长度数据产品);路径标识符、日志、位置和引用字段(路径日志数据产品);或计数、汇总和路径标识符字段(要素计数数据产品)。
|
File
|
|
in_route_features
|
将用于计算长度、路径日志或要素计数的 LRS 网络。
|
Feature Layer
|
|
effective_date
[effective_date,...]
|
定义网络时态视图的一个或多个日期。
|
Date
|
|
units
(可选)
|
指定输出中长度字段的测量单位。
仅当创建长度数据产品时,此参数才可用。
INCHES—将以英寸为单位。
FEET—单位将为英尺。
YARDS—单位将为码。
MILES—单位将为英里。
NAUTICAL_MILES—单位将为海里。
INTMILES—单位将为法定英里。
INTFEET—单位将为国际英尺。
MILLIMETERS—单位将为毫米。
CENTIMETERS—单位将为厘米。
METERS—单位将为米。
KILOMETERS—单位将为千米。
DECIMETERS—单位将为分米。
|
String
|
|
boundary_features
(可选)
|
用于汇总数据的边界图层。
仅当创建长度或要素计数数据产品时,此参数才可用。
|
Feature Layer
|
|
summary_field
(可选)
|
提供汇总行名称的边界图层字段。
仅当创建长度或要素计数数据产品时,此参数才可用。
|
Field
|
|
exclude_null_summary_rows
(可选)
|
指定是否排除空的汇总行。
仅当创建长度或要素计数数据产品时,此参数才可用。
|
Boolean
|
|
output_format
(可选)
|
指定输出文件格式。
|
String
|
|
out_file
(可选)
|
将写入计算的长度、路径日志或要素计数的输出 .csv 文件。
|
File
|
|
out_table
(可选)
|
将使用计算的长度、路径日志或要素计数创建的地理数据库表。
|
Table
|
代码示例
GenerateLrsDataProduct 示例 1(独立脚本)
以下独立脚本演示了如何使用 GenerateLrsDataProduct 函数。
# Name: GenerateLrsDataProduct_ex1.py
# Description: Transforms LRS data to create a data product for the selected routes in an LRS Network in a stand-alone script.
# Requirements: ArcGIS Location Referencing
# Import arcpy module
import arcpy
# Local tool variables
in_template = r"C:\Data\Template.json"
in_route_features = r"C:\Data\SampleData.gdb\LRS\Network"
effective_date = "12/31/2024"
units = "METERS"
boundary_features = None
summary_field = None
exclude_null_summary_rows = "EXCLUDE"
output_format = "CSV"
out_file = r"C:\Data\LP1.csv"
out_table = None
# Run the tool
arcpy.locref.GenerateLrsDataProduct(in_template, in_route_features, effective_date, units, boundary_features, summary_field, exclude_null_summary_rows, output_format, out_file, out_table)
GenerateLrsDataProduct 示例 2(Python 窗口)
以下脚本演示了如何在 Python 窗口中使用 GenerateLrsDataProduct 函数。
# Name: GenerateLrsDataProduct_ex2.py
# Description: Transforms LRS data to create a data product for the selected routes in an LRS Network in the inline Python window in ArcGIS Pro.
# Requirements: ArcGIS Location Referencing
# Local tool variables
in_template = r"C:\Data\Template.json"
in_route_features = r"C:\Data\SampleData.gdb\LRS\Network"
effective_date = "12/31/2024"
units = "METERS"
boundary_features = None
summary_field = None
exclude_null_summary_rows = "DO_NOT_EXCLUDE"
output_format = "CSV"
out_file = r"C:\Data\LP2.csv"
out_table = None
# Run the tool
arcpy.locref.GenerateLrsDataProduct(in_template, in_route_features, effective_date, units, boundary_features, summary_field, exclude_null_summary_rows, output_format, out_file, out_table)
GenerateLrsDataProduct 示例 3(独立脚本)
以下独立脚本演示了如何将 GenerateLrsDataProduct 函数与要素服务中的数据配合使用。
# Name: GenerateLrsDataProduct_ex3.py
# Description: Transforms LRS data to create a data product for the selected routes using a feature service.
# Requires: ArcGIS Location Referencing
# Import arcpy module.
import arcpy
# Input event and target LRS network are in feature service. Signing in 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 target LRS Network's layer ID.
in_route_features = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/1"
# Set tool variables
in_template = r"C:\Data\Template.json"
effective_date = "12/31/2024"
units = "FEET"
boundary_features = None
summary_field = None
exclude_null_summary_rows = "EXCLUDE"
output_format = "CSV"
out_file = r"C:\Data\LP3.csv"
out_table = None
# Run the tool
arcpy.locref.GenerateLrsDataProduct(in_template, in_route_features, effective_date, units, boundary_features, summary_field, exclude_null_summary_rows, output_format, out_file, out_table)
GenerateLrsDataProduct 示例 4(独立脚本)
以下独立脚本演示了如何将 GenerateLrsDataProduct 函数与多个生效日期配合使用。
# Name: GenerateLrsDataProduct_ex4.py
# Description: Transforms LRS data to create a data product for the selected routes in an LRS Network in a stand-alone script.
# Requirements: ArcGIS Location Referencing
# Import arcpy module
import arcpy
# Local tool variables
in_template = r"C:\Data\Template.json"
in_route_features = r"C:\Data\SampleData.gdb\LRS\Network"
effective_date = "12/31/2000; 12/31/2010; 12/31/2020"
units = "METERS"
boundary_features = None
summary_field = None
exclude_null_summary_rows = "EXCLUDE"
output_format = "TABLE"
out_file = None
out_table = r"C:\Data\SampleData.gdb\LP4"
# Run the tool
arcpy.locref.GenerateLrsDataProduct(in_template, in_route_features, effective_date, units, boundary_features, summary_field, exclude_null_summary_rows, output_format, out_file, out_table)