Available with Spatial Analyst license.
Summary
Smooths 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.
There are two smoothing processes available to use, which differ in the number of times the expansion-shrinking process is performed. With the default enabled setting of Run expansion and shrinking twice (TWO_WAY in Python), the expansion-shrinking process to smooth the input cell values is performed twice, while when the option is not enabled (ONE_WAY in Python), it is only performed one time.
In the first pass for both techniques, 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. However, in the shrinking operation of the second pass of the two-way option, 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 priority 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.
See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.
Syntax
BoundaryClean (in_raster, {sort_type}, {number_of_runs})
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. The output is always of integer type. | Raster |
Code sample
BoundaryClean example 1 (Python window)
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")
BoundaryClean example 2 (stand-alone script)
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")
Environments
Licensing information
- ArcGIS Desktop Basic: Requires Spatial Analyst
- ArcGIS Desktop Standard: Requires Spatial Analyst
- ArcGIS Desktop Advanced: Requires Spatial Analyst