Raster to Polygon (Conversion)

Summary

Converts a raster dataset to polygon features.

Usage

Syntax

RasterToPolygon_conversion (in_raster, out_polygon_features, {simplify}, {raster_field})
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. This is the default.
  • NO_SIMPLIFYThe polylines will conform to the input raster's cell edges.
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

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)

Environments

Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes

11/14/2011