當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python ArcGIS dissolve_boundaries用法及代碼示例

本文簡要介紹 python 語言中 arcgis.geoanalytics.manage_data.dissolve_boundaries 的用法。

用法:

arcgis.geoanalytics.manage_data.dissolve_boundaries(input_layer, dissolve_fields=None, summary_fields=None, multipart=False, output_name=None, gis=None, context=None, future=False)

返回:

FeatureLayerCollection

dissolve_boundaries.png

dissolve_boundaries 任務查找相交或具有相同字段值的多邊形,並將它們合並在一起以形成單個多邊形。

例子:

A city council wants to control liquor sales by refusing new licenses to stores within 1,000 feet of schools, libraries, and parks. After creating a 1,000-foot buffer around the schools, libraries, and parks, the buffered layers can be joined together and the boundaries can be dissolved to create a single layer of restricted areas.

注意:

僅在 ArcGIS Enterprise 10.7 及更高版本中可用。

Parameter

Description

input_layer

必需的層。包含將被融合的麵要素的圖層。請參閱特征輸入。

dissolve_fields

可選字符串。您想要溶解的每個字段的逗號分隔字符串列表。input_layer 中的一個或多個字段確定如何根據字段值合並多邊形。

如果不指定字段,相交的多邊形默認會分解為一個多邊形。

如果指定字段,則每個指定字段共享相同值的多邊形將被分解為一個多邊形。

summary_fields

可選的字典列表。您要計算的字段名稱和統計匯總類型的列表。請注意,始終返回計數。默認情況下,返回所有統計信息。

用法:[{"statisticType" : "<stat>", "onStatisticField" : "<field name>"}]

  • onStatisticField is the name of the field in the input point layer to calculate the statistic.

  • 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.

  • statisticType is one of the following 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.

# Example
>>> summary_fields = [{"statisticType" : "Sum", "onStatisticField" : "quadrat_area_km2"},
                      {"statisticType" : "Mean", "onStatisticField" : "soil_depth_cm"},
                      {"statisticType" : "Any", "onStatisticField" : "quadrat_desc"}]

multipart

可選布爾值。如果是 True ,則輸出服務可以包含多部分函數。如果 False ,輸出服務將僅包含 single-part 特征,並且將為每個部分創建單獨的特征。

默認值為 False

output_name

可選字符串。該任務將創建結果的要素服務。您定義服務的名稱。

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.

  • defaultAggregationStyles - If set to true, results will have square, hexagon, and triangle aggregation styles enabled on results map services.

future

可選布爾值。如果是 True ,將返回一個 future 對象,並且進程不會等待任務完成。默認為 False ,表示等待結果。

例子:

# Usage Example: This example dissolves boundaries of soil areas in Nebraska if they have
# the same solubility. For dissolved features, it calculates the sum of the quadrat area,
# the mean soil depth, and an example of the quadrat description.

arcgis.env.out_spatial_reference = 3310
arcgis.env.output_datastore= "relational"
arcgis.env.defaultAggregations= True

summary_fields = [{"statisticType" : "Sum", "onStatisticField" : "quadrat_area_km2"},
                {"statisticType" : "Mean", "onStatisticField" : "soil_depth_cm"},
                {"statisticType" : "Any", "onStatisticField" : "quadrat_desc"}]

dissolve_result = dissolve_boundaries(input_layer=study_area_lyr,
                                        dissolve_fields="soil_suitability",
                                        summary_fields=summary_fields,
                                        multipart=True,
                                        output_name="Soil_Suitability_dissolved")

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 arcgis.geoanalytics.manage_data.dissolve_boundaries。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。