Thin (Spatial Analyst)

License Level:BasicStandardAdvanced

Summary

Thins rasterized linear features by reducing the number of cells representing the width of the features.

Usage

Syntax

Thin (in_raster, {background_value}, {filter}, {corners}, {maximum_thickness})
ParameterExplanationData Type
in_raster

The input raster to be thinned.

It must be of integer type.

Raster Layer
background_value
(Optional)

Specifies the cell value that will identify the background cells. The linear features are formed from the foreground cells.

  • ZERO The background is composed of cells of 0 or less, or NoData. All cells whose value is greater than 0 are the foreground.
  • NODATA The background is composed of NoData cells. All cells with valid values belong to the foreground.
String
filter
(Optional)

Specifies whether a filter will be applied as the first phase of thinning.

  • NOFILTER No filter will be applied. This is the default.
  • FILTER The raster will be filtered to smooth the boundaries between foreground and background cells. This option will eliminate minor irregularities from the output raster.
Boolean
corners
(Optional)

Specifies whether round or sharp turns will be made at turns or junctions.

It is also used during the vector conversion process to spline curves or create sharp intersections and corners.

  • ROUND Attempts to smooth corners and junctions. This is best for vectorizing natural features, such as contours or streams.
  • SHARP Attempts to preserve rectangular corners and junctions. This is best for vectorizing man-made features such as streets.
String
maximum_thickness
(Optional)

The maximum thickness, in map units, of linear features in the input raster.

The default thickness is ten times the cell size.

Double

Return Value

NameExplanationData Type
out_raster

The output thinned raster.

Raster

Code Sample

Thin example 1 (Python window)

This example thins a raster where the background values are NoData, and smooths the boundaries while attempting to preserve corners and junctions.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
thinOut = Thin("land","NODATA", "FILTER", "SHARP", 300)
thinOut.save("c:/sapyexamples/output/thinout")
Thin example 2 (stand-alone script)

This example thins a raster where the background values are NoData, and smooths the boundaries while attempting to preserve corners and junctions.

# Name: Thin_Ex_02.py
# Description: Thins rasterized linear features by 
#              reducing the number of cells 
#              representing the width of the features.
# 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"
tolerance = 300

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute Thin
thinOut = Thin(inRaster, "NODATA", "FILTER", "SHARP", tolerance)

# Save the output 
thinOut.save("c:/sapyexamples/output/thinoutput")

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Requires Spatial Analyst
ArcGIS for Desktop Standard: Requires Spatial Analyst
ArcGIS for Desktop Advanced: Requires Spatial Analyst
11/8/2012