本文簡要介紹 python 語言中 arcgis.geoanalytics.summarize_data.aggregate_points
的用法。
用法:
arcgis.geoanalytics.summarize_data.aggregate_points(point_layer, bin_type=None, bin_size=None, bin_size_unit=None, polygon_layer=None, time_step_interval=None, time_step_interval_unit=None, time_step_repeat_interval=None, time_step_repeat_interval_unit=None, time_step_reference=None, summary_fields=None, output_name=None, gis=None, future=False, context=None)
返回:
result_layer :將要素輸出為
FeatureLayer
。
此
aggregate_points
工具適用於一層點要素和一層區域。區域層可以是輸入多邊形層,也可以是運行任務時計算的正方形或六邊形 bin。該工具首先確定哪些點位於每個指定區域內。在確定了這個point-in-area空間關係後,計算該區域內所有點的統計數據並分配給該區域。最基本的統計數據是該區域內的點數,但您也可以獲得其他統計數據。例如,假設您有咖啡店位置的點特征和縣的區域特征,並且您想按縣匯總咖啡銷售。假設咖啡店有一個TOTAL_SALES屬性,你可以得到每個縣內所有TOTAL_SALES的總和,每個縣內最小或最大TOTAL_SALES,或其他統計數據,如計數、範圍、標準差和方差.
此工具還可以處理time-enabled 的數據。如果在輸入點上啟用了時間,則時間切片選項可用。時間切片允許您在查看特定時間切片的同時計算point-in 區域關係。例如,您可以查看每小時間隔,這將導致每小時的輸出。
以時間為例,假設您有在咖啡店位置進行的每筆交易的點特征,並且沒有區域圖層。這些數據已經記錄了一年多,每筆交易都有一個位置和一個時間戳。假設每筆交易都有一個TOTAL_SALES 屬性,您可以獲得感興趣的空間和時間內所有 TOTAL SALES 的總和。如果這些交易是針對單個城市的,我們可以生成一公裏網格的區域,並查看每周的時間片來總結時間和空間上的交易。
注意:
必須指定
bin_type
或polygon_layer
。如果使用bin_type
,則必須同時包含bin_size
和bin_size_unit
。Parameter
Description
point_layer
必填點
FeatureLayer
。將聚合到polygon_layer
中的麵或bin_type
指定的箱中的點要素。請參閱特征輸入。bin_type
可選字符串。如果未提供
polygon_layer
,則為必需。將生成的 bin 類型以及將聚合的點。
選擇清單:
Square
Hexagon
默認值為
Square
。注意:如果未提供
polygon_layer
,則為必需。bin_size(如果使用
bin_type
,則為必需)可選浮點數。
point_layer
將聚合到的bin_type
的每個 bin 的維度。if
Square
- the height and length of the sidesif
Hexagon
- the distance between parallel sides
bin_size_unit(如果使用
bin_size
,則為必需)可選字符串。
bin_type
指定的 bin 的單位,point_layer
將聚合到其中。選擇清單:
Feet
Yards
Miles
Meters
Kilometers
NauticalMiles
- 對於
bin_type
: if
Square
-bin_size
邊的高度和長度的單位if
Hexagon
- 平行邊之間bin_size
的單位
polygon_layer
可選多邊形
feature layer
。輸入點將聚合到的麵要素(區域)。請參閱特征輸入。注意:如果未提供
bin_type
,則為必需。time_step_interval
可選整數。一個數值,指定時間步長間隔的持續時間。此選項僅在輸入點為 time-enabled 且代表時間瞬間時可用。
默認值為
None
。time_step_interval_unit
可選字符串。指定時間步間隔單位的字符串。
注意:僅當輸入點為 time-enabled 且表示時間點時才可用。
選擇清單:
Years
Months
Weeks
Days
Hours
Minutes
Seconds
Milliseconds
默認值為
None
。time_step_repeat_interval
可選整數。一個數值,指定時間步重複發生的頻率。僅當輸入點為 time-enabled 且時間類型為即時時,此選項才可用。
time_step_repeat_interval_unit
可選字符串。指定步驟重複的時間單位的字符串。
注意:僅當輸入點為 time-enabled 且時間類型為
instant
時,此選項才可用。- 選擇清單:
Years
Months
Weeks
Days
Hours
Minutes
Seconds
Milliseconds
默認值為
None
。time_step_reference
可選的日期時間。一個日期,指定將時間片對齊到的參考時間,以從紀元開始的毫秒數表示。默認值為 1970 年 1 月 1 日淩晨 12:00(紀元時間戳 0)。僅當輸入點為 time-enabled 且時間類型為即時時,此選項才可用。
summary_fields
可選的字典列表。要為每個多邊形或 bin 內的所有點計算的字段名稱和統計匯總類型的列表。請注意,始終返回每個多邊形內的點數。默認情況下,返回所有統計信息。
例子:
[{"statisticType": "Count", "onStatisticField": "fieldName1"}, {"statisticType": "Any", "onStatisticField": "fieldName2"}]
onStatisticField
is the name of the field in the input point layer.statisticType
is one of the following:for numeric fields:
Count
- Totals the number of values of all the points in each polygon.Sum
- Adds the total value of all the points in each polygon.Mean
- Calculates the average of all the points in each polygon.Min
- Finds the smallest value of all the points in each polygon.Max
- Finds the largest value of all the points in each polygon.Range
- Finds the difference between the Min and Max values.Stddev
- Finds the standard deviation of all the points in each polygon.Var
- Finds the variance of all the points in each polygon.
for string fields:
Count
- Totals the number of strings for all the points in each polygon.Any
- Returns a sample string of a point in each polygon.
output_name
可選字符串。該方法將創建結果的要素服務。您定義服務的名稱。
gis
可選,運行此工具的
GIS
。如果未指定,則使用活動 GIS。context
可選字典。 context 參數包含影響任務執行的其他設置。對於此任務,有四個設置:
extent
- a bounding box that defines the analysis area. Only those features that intersect the bounding box will be analyzed.processSR
- The features will be projected into this coordinate system for analysis.outSR
- the features will be projected into this coordinate system after the analysis to be saved. The output spatial reference for the spatiotemporal big data store is always WGS84.dataStore
- results will be saved to the specified data store. For ArcGIS Enterprise, the default is the spatiotemporal big data store.
future
可選布爾值。如果是
True
,將返回一個 future 對象,並且進程不會等待任務完成。默認為False
,表示等待結果。例子:
# Usage Example: To aggregate number of 911 calls within 1 km summarized by Day count. agg_result = aggregate_points(calls, bin_size=1, bin_size_unit='Kilometers', time_step_interval=1, time_step_interval_unit="Years", summary_fields=[{"statisticType": "Count", "onStatisticField": "Day"}], output_name='testaggregatepoints01')
相關用法
- Python ArcGIS aggregate_points用法及代碼示例
- Python ArcGIS aggregate_multidimensional_raster用法及代碼示例
- Python ArcGIS aggregate用法及代碼示例
- Python ArcGIS acos用法及代碼示例
- Python ArcGIS add_image用法及代碼示例
- Python ArcGIS abs用法及代碼示例
- Python ArcGIS acosh用法及代碼示例
- Python ArcGIS arithmetic用法及代碼示例
- Python ArcGIS aspect_slope用法及代碼示例
- Python ArcGIS analyze_changes_using_ccdc用法及代碼示例
- Python ArcGIS asinh用法及代碼示例
- Python ArcGIS asin用法及代碼示例
- Python ArcGIS atan2用法及代碼示例
- Python ArcGIS atanh用法及代碼示例
- Python ArcGIS aspect用法及代碼示例
- Python ArcGIS areas_and_lengths用法及代碼示例
- Python ArcGIS atan用法及代碼示例
- Python ArcGIS analyze_changes_using_landtrendr用法及代碼示例
- Python ArcGIS power用法及代碼示例
- Python ArcGIS APIKeyManager.get用法及代碼示例
- Python ArcGIS KnowledgeGraph.named_object_type_delete用法及代碼示例
- Python ArcGIS ContentManager.unshare_items用法及代碼示例
- Python ArcGIS ImageryLayer.thumbnail用法及代碼示例
- Python ArcGIS FormFieldElement用法及代碼示例
- Python ArcGIS Geometry.true_centroid用法及代碼示例
注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 arcgis.geoanalytics.summarize_data.aggregate_points。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。