Skip To Content

Raster to Polygon

Summary

Converts a raster dataset to polygon features.

Usage

  • The input raster can have any cell size and must be a valid integer raster dataset.

  • The Field parameter allows you to choose which attribute field of the input raster dataset will become an attribute in the output feature class. If a field is not specified, the cell values of the input raster (the VALUE field) will become a column with the heading Gridcode in the attribute table of the output feature class.

  • The following graphic illustrates how the input raster is vectorized when it is converted to a polygon feature output. The result is presented for both the settings of the Simplify parameter.

    Illustration of output with different simplify options
    Comparing the output with different simplify options
  • If the Create multipart features parameter is checked (MULTIPLE_OUTER_PART in Python), the output will be a multipart feature class and, on average, process faster. However, if the output feature class contains a very large number of features, it may cause an out of memory error. The grouping process is similar to what is used in the Dissolve tool.

  • The Maximum vertices per polygon parameter can be used to subdivide a polygon into smaller polygons based on a specified vertex limit. This is particularly useful when output features contain a very large number of vertices. This parameter produces similar output as created by the Dice tool.

  • If Extent is specified in the environment setting and the lower-left corner of the output extent does not match any cell corner of the input raster, during processing, a shift of the cell alignment of the input raster will occur to match the specified extent. This shift will trigger a resampling of the input raster using the Nearest Neighbor method. Consequently, the output features will shift as well, and the resultant output features may not overlay the original input raster exactly. You can avoid this shift by using the input raster as the Snap Raster in the environment.

Syntax

RasterToPolygon_conversion (in_raster, out_polygon_features, {simplify}, {raster_field}, {create_multipart_features}, {max_vertices_per_feature})
ParameterExplanationData Type
in_raster

The input raster dataset.

The raster must be integer type.

Raster Layer
out_polygon_features

The output feature class that will contain the converted polygons.

Feature Class
simplify
(Optional)

Determines if the output polygons will be smoothed into simpler shapes or conform to the input raster's cell edges.

  • SIMPLIFYThe polygons will be smoothed into simpler shapes. The smoothing is done in such a way that the polygons contain a minimum number of segments while remaining as close as possible the original raster cell edges. This is the default.
  • NO_SIMPLIFYThe edge of the polygons will conform exactly to the input raster's cell edges. With this option, converting the resulting polygon feature class back to a raster would produce a raster the same as the original.
Boolean
raster_field
(Optional)

The field used to assign values from the cells in the input raster to the polygons in the output dataset.

It can be an integer or a string field.

Field
create_multipart_features
(Optional)

Specifies whether the output polygons will consist of single-part or multipart features.

  • MULTIPLE_OUTER_PARTSpecifies that multipart features will be created based on polygons that have the same value.
  • SINGLE_OUTER_PARTSpecifies that individual features will be created for each polygon. This is the default.
Boolean
max_vertices_per_feature
(Optional)

The vertex limit used to subdivide a polygon into smaller polygons. This parameter produces similar output as created by the Dice tool.

If left empty, the output polygons will not be split. The default is empty.

Long

Code sample

RasterToPolygon example (Python window)

Converts a raster dataset to polygon features.

import arcpy
from arcpy import env
env.workspace = "C:/data"
arcpy.RasterToPolygon_conversion("zone", "c:/output/zones.shp", "NO_SIMPLIFY",
                                  "VALUE")
RasterToPolygon example (stand-alone script)

Converts a raster dataset to polygon features.

# Name: RasterToPolygon_Ex_02.py
# Description: Converts a raster dataset to polygon features.
# Requirements: None

# Import system modules
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "C:/data"

# Set local variables
inRaster = "zone"
outPolygons = "c:/output/zones.shp"
field = "VALUE"

# Execute RasterToPolygon
arcpy.RasterToPolygon_conversion(inRaster, outPolygons, "NO_SIMPLIFY", field)

Licensing information

  • ArcGIS Desktop Basic: Yes
  • ArcGIS Desktop Standard: Yes
  • ArcGIS Desktop Advanced: Yes

Related topics