Boundary Clean (Spatial Analyst)
Summary
Smoothes the boundary between zones by expanding and shrinking it.
Illustration
Usage
-
All regions of less than three cells in the x- or y-direction will be changed.
The shrinking that occurs with the ONE_WAY smoothing process (expansion-shrinking process run once) or the first pass when the TWO_WAY smoothing process is different than the shrinking that occurs with the second pass of the TWO_WAY smoothing.
In the first pass, for any processing cell in the expanded raster that has a neighbor of the original value of the processing cell, the original value of the processing cell will be recovered. In the second pass of TWO_WAY, any cell in the expanded raster that is not completely surrounded by eight cells of the same value will recover its original value.
-
The expansion is identical for the first and second pass.
-
Input cells of NoData have the lowest prioroty in the ONE_WAY sorting type, or in the first pass of TWO_WAY sorting. In the second pass of TWO_WAY sorting, cells of NoData have the highest priority.
Syntax
Parameter | Explanation | Data Type |
in_raster |
The input raster for which the boundary between zones will be smoothed. It must be of integer type. | Raster Layer |
sort_type (Optional) |
Specifies the type of sorting to use in the smoothing process. This determines the priority by which cells can expand into their neighbors.
| String |
number_of_runs (Optional) |
Specifies the number of directions in which the smoothing process will take place.
| Boolean |
Return Value
Name | Explanation | Data Type |
out_raster |
The output generalized raster. The boundaries between zones in the input will be smoothed. | Raster |
Code Sample
This example smooths the boundary between zones in a descending order with a two-way run.
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")
This example smooths the boundary between zones in a descending order with a two-way run.
# 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")