arcpy.management.MakeAggregationQueryLayer(target_feature_class, target_join_field, related_table, related_join_field, out_layer, {statistics}, {parameter_definitions}, {oid_fields}, {shape_type}, {srid}, {spatial_reference}, {m_values}, {z_values}, {extent})
|
名前
|
説明
|
データ タイプ
|
|
target_feature_class
|
エンタープライズ データベースのフィーチャクラスまたは空間テーブル。
|
Feature Class
|
|
target_join_field
|
結合のキーとなるターゲット フィーチャクラスのフィールド。
|
Field
|
|
related_table
|
統計の計算に使用するフィールドを含む入力テーブル。 統計は out_layer 値に結合されます。
|
Table; Feature Class
|
|
related_join_field
|
結合のキーとなる値が格納されている、集計テーブル内のフィールド。 集約または統計サマリーも、このフィールドの一意の属性値ごとに個別に計算されます。
|
Field
|
|
out_layer
|
作成されるクエリー レイヤーの出力名。
|
Feature Layer
|
|
statistics
[[statistic_type, field],...]
(オプション)
|
属性値を含み、特定の統計の計算に使用される数値フィールドを指定します。 複数の統計とフィールドの組み合わせを指定できます。 すべての統計計算から NULL 値が除外されます。
出力レイヤーには、related_join_field 値の各個別値の合計数 (または頻度) を示す ROW_COUNT フィールドが含まれます。 ROW_COUNT フィールドと COUNT 統計タイプの違いは、COUNT では NULL 値が除外されるのに対し、ROW_COUNT には NULL 値が含まれる点です。
値テーブル列:
|
Value Table
|
|
parameter_definitions
[[parameter_def_type, name, alias, field_or_expression, data_type, start_value, end_value, operator, default_value, operator_for_next_parameter],...]
(オプション)
|
1 つ以上のクエリー パラメーターを基準または条件として指定し、これらの基準に一致するレコードを使用して集約結果を計算します。 クエリー パラメーターは、クエリーが実行されるときに値が定義される SQL ステートメント変数に似ています。 これにより、出力レイヤーのクエリー フィルターを動的に変更することができます。 パラメーターは、SQL の WHERE 句における述部や条件と見なすことができます。 たとえば、SQL の WHERE 句にある Country_Name = 'Nigeria' は述部と呼ばれ、= は比較演算子、左側の Country_Name はフィールド名、右側の 'Nigeria' は値を表しています。 複数のパラメーターを定義する場合は、それらの間に論理演算子 (AND、OR など) を指定する必要があります。
クエリー レイヤーでのパラメーターの定義の詳細
指定しない場合、関連テーブルのすべてのレコードが集約結果または集計結果の計算に使用されます。
2 つのパラメーター定義タイプは次のとおりです。
値テーブル列:
Parameter Type—Specifies the parameter type.
Name—The name of the parameter, which is similar to a variable name. A name cannot contain spaces or special characters. Once the output query layer is created and the layer source SQL statement is checked, this name in the SQL statement that defines the output query layer source will be prefixed with either ::r: (for range parameter) or :: (for discrete parameter).
Alias—The alias for the parameter name. The alias can include spaces and special characters.
Field or Expression—A field name or a valid SQL expression that will be used in the left side of a predicate or condition in a where clause.
Data type—The data type of the field or expression specified in the Field or Expression column. When using a range parameter type, the data type cannot be string.
DATE—The data type of the field or expression will be Date (date time).
STRING—The data type of the field or expression will be String (text).
INTEGER—The data type of the field or expression will be Integer (whole numbers).
DOUBLE—The data type of the field or expression will be Double (fractional numbers).
Start Value—The default start value for the range parameter type. This is the value that will be used when the time or range slider is not enabled. When the start value and end value column values are omitted and the time or range slider is disabled, all records from the related table will be used to compute aggregated results. This value is ignored when using a discrete parameter type.
End Value—The default end value for the range parameter. This is the value that will be used when the time or range slider is not enabled. When the start value and end value column values are omitted and the time or range slider is disabled, all records from the related table will be used to compute aggregated results. This value is ignored when using a discrete parameter type.
Operator for Discrete Parameters—The comparison operator that will be used between the Field or Expression column value and a value in an SQL predicate or condition.
NONE—Use this option when using a range parameter type.
EQUAL TO—Compare the equality of a field or expression to a value.
NOT EQUAL TO—Test whether a field or expression is not equal to a value.
GREATER THAN—Test whether a field or expression is higher than a value.
LESS THAN—Test whether a field or expression is lower than a value.
INCLUDE VALUES—Determine whether a value from a field or expression matches any value in a list.
Default Discrete Parameters—When using a discrete parameter type, you must provide a default value. When the operator is include values, you can provide multiple values separated by commas, for example VANDALISM,BURGLARY/THEFT.
Operator for Next Parameters—The logical operator between this operator and the next one. This column is only applicable when you have more than one parameter definition.
NONE—Use this option when there are no more parameters
AND—Combine two conditions and select a record if both conditions are true.
OR—Combine two conditions and select a record if at least one condition is true.
|
Value Table
|
|
oid_fields
[oid_fields,...]
(オプション)
|
テーブル内の各行を一意に識別するために使用される一意の識別子フィールド。
|
String
|
|
shape_type
(オプション)
|
クエリー レイヤーのシェープ タイプを指定します。 クエリーの結果セットに含まれるレコードのうち、指定したシェープ タイプに一致するレコードだけが出力クエリー レイヤーで使用されます。 デフォルトでは、結果セットの最初のレコードのシェープ タイプが使用されます。 クエリーの結果セットがジオメトリー フィールドを返さない場合、このパラメーターは無視されます。
POINT—出力クエリー レイヤーはポイント ジオメトリーを使用します。
MULTIPOINT—出力クエリー レイヤーはマルチポイント ジオメトリーを使用します。
POLYGON—出力クエリー レイヤーはポリゴン ジオメトリーを使用します。
POLYLINE—出力クエリー レイヤーはポリライン ジオメトリーを使用します。
|
String
|
|
srid
(オプション)
|
ジオメトリーを返すクエリーの空間参照 ID (SRID)。 クエリーの結果セットに含まれるレコードのうち、指定した SRID 値に一致するレコードだけが出力クエリー レイヤーで使用されます。 デフォルトでは、結果セットの最初のレコードの SRID 値が使用されます。 クエリーの結果セットがジオメトリー フィールドを返さない場合、このパラメーターは無視されます。
|
String
|
|
spatial_reference
(オプション)
|
出力クエリー レイヤーで使用する座標系。 デフォルトでは、結果セットの最初のレコードの空間参照が使用されます。 クエリーの結果セットがジオメトリー フィールドを返さない場合、このパラメーターは無視されます。
|
Spatial Reference
|
|
m_values
(オプション)
|
出力レイヤーに距離計測値 (M 値) を含めるかどうかを指定します。
|
Boolean
|
|
z_values
(オプション)
|
出力レイヤーに標高値 (Z 値) を含めるかどうかを指定します。
|
Boolean
|
|
extent
(オプション)
|
レイヤーの範囲を指定します。 この範囲にはテーブル内のすべてのフィーチャを含める必要があります。
MAXOF - すべての入力データの最大範囲が使用されます。
MINOF - すべての入力データに共通する最小領域が使用されます。
DISPLAY - 範囲は、表示範囲と同じになります。
レイヤー名 - 指定されたレイヤーの範囲が使用されます。
Extent オブジェクト - 指定されたオブジェクトの範囲が使用されます。
スぺース区切りの座標文字列 - 指定された文字列の範囲が使用されます。 座標値は、x-min、y-min、x-max、y-max という順序で表記されます。
|
Extent
|
コードのサンプル
MakeAggregationQueryLayer の例 1 (Python ウィンドウ)
次の Python ウィンドウ スクリプトは、ポイント フィーチャクラスから地区ごとの総犯罪数を計算し、その結果を警察管区フィーチャクラスに結合する方法を示しています。
import arcpy
arcpy.env.workspace = "C:/data/localhost.sde"
arcpy.management.MakeAggregationQueryLayer(
"PoliceDistricts", "district", "Crime_locations", "PdDistrict", "SF_Crimes")
MakeAggregationQueryLayer の例 2 (Python ウィンドウ)
次の Python ウィンドウ スクリプトは、ポイント フィーチャクラスから地区ごとおよび犯罪タイプごとの総犯罪数を計算し、その結果を警察管区フィーチャクラスに結合する方法を示しています。
import arcpy
arcpy.env.workspace = "C:/data/localhost.sde"
arcpy.management.MakeAggregationQueryLayer(
"PoliceDistricts", "district", "Crime_locations", "PdDistrict", "SF_Crimes",
None,
"DISCRETE crime_type # Category STRING # # 'INCLUDE VALUES' 'VANDALISM, BURGLARY/THEFT' NONE")
MakeAggregationQueryLayer の例 3 (Python ウィンドウ)
次の Python ウィンドウ スクリプトは、時系列テーブルから総雨量と平均雨量を計算し、その結果を給水地フィーチャクラスに結合する方法を示しています。
import arcpy
arcpy.env.workspace = "C:/data/localhost.sde"
arcpy.management.MakeAggregationQueryLayer(
"weather_stations", "station_id", "observed_rainfall", "station_id",
"Total_Rainfall", [["SUM", "rainfall_inch"], ["MIN", "rainfall_inch"]])
MakeAggregationQueryLayer の例 4 (Python ウィンドウ)
次の Python ウィンドウ スクリプトは、時系列テーブルから任意のタイム ウィンドウの総雨量と平均雨量を計算し、その結果を給水地フィーチャクラスに結合する方法を示しています。
import arcpy
arcpy.env.workspace = "C:/data/localhost.sde"
arcpy.management.MakeAggregationQueryLayer(
"weather_stations", "station_id", "observed_rainfall", "station_id",
"Total_Rainfall", [["SUM", "rainfall_inch"], ["MIN", "rainfall_inch"]],
"RANGE TimeVar # collection_date DATE 1/1/2020 12/1/2020 NONE # NONE")