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})
|
名前
|
説明
|
データ タイプ
|
|
in_route_features
|
LRS 長さデータ プロダクトの計算に使用されるルート フィーチャ。
|
Feature Layer
|
|
effective_date
|
ネットワークの時間ビューの定義に使用される日付。
デフォルト値は、今日の日付です。
|
Date
|
|
units
|
出力の長さフィールドに使用する計測単位を指定します。
|
String
|
|
summary_fields
[summary_fields,...]
(オプション)
|
出力でサマリー行の名前の表示に使用されるレイヤーのフィールド。
値テーブル列:
Layer—The feature layer that will be used as the summary layer.
Field—The field that will be used to summarize the length.
Output Field Name—The summary field's display name in the output.
|
Value Table
|
|
length_fields
[length_fields,...]
(オプション)
|
出力でルートの長さの表示に使用されるレイヤーのフィールド。
値テーブル列:
|
Value Table
|
|
exclude_null_summary_rows
(オプション)
|
NULL のサマリー行を出力から除外するかどうかを指定します。
|
Boolean
|
|
calculate_length_for_dominant_routes
(オプション)
|
注意:
このパラメーターのサポートは、今後のリリースで追加される予定です。
|
Boolean
|
|
output_format
(オプション)
|
出力の形式を指定します。
|
String
|
|
out_file
(オプション)
|
長さデータ プロダクトが格納される出力 .csv ファイル。
|
File
|
|
out_table
(オプション)
|
長さデータ プロダクトが格納される出力ジオデータベース テーブル。
|
Table
|
コードのサンプル
GenerateLRLengthSummary の例 1 (スタンドアロン スクリプト)
次のスタンドアロン スクリプトは、スタンドアロン スクリプトで GenerateLRLengthSummary 関数を使用する方法を示しています。
# 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
# 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)
GenerateLRLengthSummary の例 2 (Python ウィンドウ)
次のスクリプトは、Python ウィンドウで GenerateLRLengthSummary 関数を使用する方法を示しています。
# 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)
GenerateLRLengthSummary の例 3 (スタンドアロン スクリプト)
次のスタンドアロン スクリプトは、フィーチャ サービスからのデータで GenerateLRLengthSummary 関数を使用する方法を示しています。
# 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
# 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)