ArcGIS教程:边界清理 (Spatial Analyst)

  摘要

  通过扩展和收缩来平滑区域间的边界。

  插图

  

  用法

  · 将更改 x 和 y 方向上所有少于三个像元的区域。

  · ONE_WAY 平滑过程(扩展-收缩过程运行一次)或 TWO_WAY 平滑过程的第一个过程中发生的收缩不同于 TWO_WAY 平滑过程的第二个过程中发生的收缩。

  在第一个过程中,对于扩展栅格中的任意待处理像元,如果其邻近像元具有待处理像元的原始值,则将恢复该待处理像元的原始值。在 TWO_WAY 平滑过程的第二个过程中,如果扩展栅格中的任意像元周围的八个像元的值不完全相同,则将恢复该像元的原始值。

  · 第一个过程和第二个过程发生的扩展完全相同。

  · 值为 NoData 的输入像元在 ONE_WAY 排序类型或在 TWO_WAY 排序的第一次运行中具有最低的优先级。在 TWO_WAY 排序的第二次排序中,NoData 像元拥有最高优先级。

  代码实例

  边界清理 (BoundaryClean) 示例 1(Python 窗口)

  本示例执行双向处理以降序顺序平滑区域间边界。

  import arcpy

  from arcpy import env

  from arcpy.sa import *

  env.workspace = “C:/sapyexamples/data”

  OutBndCln = BoundaryClean(“land”, “DESCEND”, “TWO_WAY”)

  OutBndCln.save(“c:/sapyexamples/output/bndcln_des2”)

  边界清理 (BoundaryClean) 示例 2(独立脚本)

  本示例执行双向处理以降序顺序平滑区域间边界。

  # Name: BoundaryClean_Ex_02.py

  # Description: Smoothes the boundary between zones

  # by expanding and shrinking it.

  # Requirements: Spatial Analyst Extension

  # Import system modules

  import arcpy

  from arcpy import env

  from arcpy.sa import *

  # Set environment settings

  env.workspace = “C:/sapyexamples/data”

  # Set local variables

  inRaster = “land”

  # Check out the ArcGIS Spatial Analyst extension license

  arcpy.CheckOutExtension(“Spatial”)

  # Execute BoundaryClean

  OutBndCln = BoundaryClean(inRaster, “ASCEND”, “TWO_WAY”)

  # Save the output

  OutBndCln.save(“c:/sapyexamples/output/bndcln_asc2”)

转载自:https://blog.csdn.net/dsac1/article/details/49509041

You may also like...