本文簡要介紹 python 語言中 arcgis.geoanalytics.summarize_data.build_multivariable_grid
的用法。
用法:
arcgis.geoanalytics.summarize_data.build_multivariable_grid(input_layers, variable_calculations, bin_size, bin_unit='Meters', bin_type='Square', output_name=None, gis=None, future=False, context=None)
返回:
布爾值
build_multivariable_grid
任務適用於一層或多層點、線或麵要素。該任務生成正方形或六邊形 bin 的網格,並將有關每個輸入層的信息編譯到每個 bin 中。對於每個輸入層,此信息可以包括以下變量:Distance to Nearest
- The distance from each bin to the nearest feature.Attribute of Nearest
- An attribute value of the feature nearest to each bin.Attribute Summary of Related
- A statistical summary of all features withinsearch_distance
of each bin.
隻有您在
variable_calculations
中指定的變量才會包含在結果層中。這些變量可以幫助您了解整個分析範圍內數據的接近程度。結果可以幫助您回答以下問題:Given multiple layers of public transportation infrastructure, what part of the city is least accessible by public transportation?
Given layers of lakes and rivers, what is the name of the water body closest to each location in the U.S.?
Given a layer of household income, where in the U.S. is the variation of income in the surrounding 50 miles the greatest?
build_multivariable_grid
的結果也可用於預測和分類工作流程。該任務允許您一步計算來自許多不同數據源的信息並將其編譯到一個空間連續的圖層中。然後可以將此圖層與 Enrich From Multi-Variable Grid 任務一起使用,以使用您計算的變量快速豐富點要素,從而減少從點數據構建預測和分類模型所需的工作量。Parameter
Description
input_layers
所需的圖層列表。將在分析中使用的輸入層列表。請參閱特征輸入。
variable_calculations
所需的字典列表。包含對象的字典,這些對象說明將為
input_layers
中的每一層計算的變量。variable_calculations = [ { "layer":<index>, "variables":[ { "type":"DistanceToNearest", "outFieldName":"<output field name>", "searchDistance":<number>, "searchDistanceUnit":"<unit>", "filter":"<filter>" }, { "type":"AttributeOfNearest", "outFieldName":"<output field name>", "attributeField":"<field name>", "searchDistance":<number>, "searchDistanceUnit":"<unit>", "filter":"<filter>" }, { "type":"AttributeSummaryOfRelated", "outFieldName":"<output field name>", "statisticType":"<statistic type>", "statisticField":"<field name>", "searchDistance":<number>, "searchDistanceUnit":"<unit>", "filter":"<filter>" }, ] }, ]
上述片段的說明:
layer
is the index of the layer ininput_layers
that will be used to calculate the specified variables.variables
is an array of dict objects that describe the variables you want to include in the result layer. The array must contain at least one variable for each layer.type
can be one of the following variable types:DistanceToNearest
AttributeOfNearest
AttributeSummaryOfRelated
Each type must be configured with a unique set of parameters:
outFieldName
is the name of the field that will be created in the result layer to store a variable. This is required.searchDistance
is a number andsearchDistanceUnit
is a linear unit.- For:
DistanceToNearest
andAttributeOfNearest
- both are required to define the maximum distance that the tool will search from the center of each bin to find a feature in the layer. If no feature is within the distance, null is returned.AttributeSummaryOfRelated
- , they are optional to define the radius of a circular neighborhood surrounding each bin. All features that intersect this neighborhood will be used to calculatestatisticType
. If a distance is not defined, only features that intersect a bin will be used to calculatestatisticType
.
attributeField
is required byAttributeOfNearest
and is the name of a field ` in the input layer. The value of this field in the closest feature to each bin will be included in the result layer.statisticField
is required byAttributeSummaryOfRelated
and is the name of a field in the input layer. This field’s values will be used to calculatestatisticType
.statisticType
is required byAttributeSummaryOfRelated
and is one of the followingwhen
statisticField
is a numeric field:Count
- Totals the number of features near or intersecting each bin.Sum
- Adds the total value of all features near or intersecting each bin.Mean
- Calculates the average of all features near or intersecting each bin.Min
- Finds the smallest value of all features near or intersecting each bin.Max
- Finds the largest value of all features near or intersecting each bin.Range
- Finds the difference between Min and Max.Stddev
- Finds the standard deviation of all features near or intersecting each bin.Var
- Finds the variance of all features near or intersecting each bin.
when
statisticField
is a string field:Count
- Totals the number of strings for all features near or intersecting each bin.Any
- Returns a sample string of all features near or intersecting each bin.
filter
is optional for all variable types and is formatted as described in the Feature Input topic.
bin_size
所需浮點數。輸出多邊形圖層中
bin_type
類型的 bin 的距離。variable_calculations
將在每個 bin 的中心計算。生成 bin 時,if
bin_type
isSquare
- the number and units specified determine the height and length of the square.if
bin_type
isHexagon
0 the number and units specified determine the distance between parallel sides.
bin_unit
可選字符串。將用於計算
variable_calculations
的 bin 的距離單位。選擇清單:
Feet
Yard
Miles
Meters
Kilometers
NauticalMiles
bin_type
可選字符串。將用於生成結果網格的 bin 類型。 Bin 選項如下:
選擇清單:
Hexagon
Square
注意:使用
Square
或Hexagon
bin 進行分析需要投影坐標係。將圖層聚合到 bin 中時,輸入圖層或處理範圍 (processSR
) 必須具有投影坐標係。如果運行分析時未指定投影坐標係,則將使用世界圓柱等積 (WKID 54034) 投影。在 10.7 或更高版本中,如果運行分析時未指定投影坐標係,將根據數據範圍選取投影。
output_name
可選字符串。該任務將創建結果的要素服務。您定義服務的名稱。
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 create multivariable grid by summarizing information such as distance to nearest variables = [ { "layer":0, "variables":[ { "type":"DistanceToNearest", "outFieldName":"road", "searchDistance":10, "searchDistanceUnit":"Kilometers" } ] }, { "layer":1, "variables":[ { "type":"AttributeSummaryOfRelated", "outFieldName":"MeanPopAge", "statisticType":"Mean", "statisticField":"Age", "searchDistance":50, "searchDistanceUnit":"Kilometers" } ] } ] grid = build_multivariable_grid(input_layers=[lyr0, lyr1], variable_calculations=variables, bin_size=100, bin_unit='Meters', bin_type='Square', output_name="multi_variable_grid")
相關用法
- Python ArcGIS build_multidimensional_transpose用法及代碼示例
- Python ArcGIS build_overview用法及代碼示例
- Python ArcGIS build_footprints用法及代碼示例
- Python ArcGIS buffer用法及代碼示例
- Python ArcGIS bitwise_not用法及代碼示例
- Python ArcGIS bitwise_left_shift用法及代碼示例
- Python ArcGIS bitwise_xor用法及代碼示例
- Python ArcGIS bitwise_right_shift用法及代碼示例
- Python ArcGIS boolean_or用法及代碼示例
- Python ArcGIS band_arithmetic用法及代碼示例
- Python ArcGIS boundary_clean用法及代碼示例
- Python ArcGIS boolean_not用法及代碼示例
- Python ArcGIS bitwise_or用法及代碼示例
- Python ArcGIS batch_geocode用法及代碼示例
- Python ArcGIS boolean_and用法及代碼示例
- Python ArcGIS boolean_xor用法及代碼示例
- Python ArcGIS bitwise_and用法及代碼示例
- 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用法及代碼示例
- Python ArcGIS Site.delete用法及代碼示例
注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 arcgis.geoanalytics.summarize_data.build_multivariable_grid。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。