Raster to Polyline (Conversion)

License Level:BasicStandardAdvanced


Converts a raster dataset to polyline features.



RasterToPolyline_conversion (in_raster, out_polyline_features, {background_value}, {minimum_dangle_length}, {simplify}, {raster_field})
ParameterExplanationData Type

The input raster dataset.

The raster must be integer type.

Raster Layer

The output feature class that will contain the converted polylines.

Feature Class

Specifies the value that will identify the background cells. The raster dataset is viewed as a set of foreground cells and background cells. The linear features are formed from the foreground cells.

  • ZEROThe background is composed of cells of zero or less or NoData. All cells with a value greater than zero are considered a foreground value.
  • NODATAThe background is composed of NoData cells. All cells with valid values belong to the foreground.

Minimum length of dangling polylines that will be retained. The default is zero.


Simplifies a line by removing small fluctuations or extraneous bends from it while preserving its essential shape.

  • SIMPLIFYThe polylines will be simplified into simpler shapes such that each contains a minimum number of segments. This is the default.
  • NO_SIMPLIFYThe polylines will not be simplified.

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

It can be an integer or a string field.


Code Sample

RasterToPolyline example (Python window)

Converts a raster dataset to polyline features.

import arcpy
from arcpy import env
env.workspace = "c:/data"
arcpy.RasterToPolyline_conversion("flowstr", "c:/output/streams.shp", "ZERO",
                                   50, "SIMPLIFY")
RasterToPolyline example (stand-alone script)

Converts a raster dataset to polyline features.

# Name: RasterToPolyline_Ex_02.py
# Description: Converts a raster dataset to polyline features.
# Requirements: None

# Import system modules
import arcpy
from arcpy import env

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

# Set local variables
inRaster = "flowstr"
outLines = "c:/output/flowstream.shp"
backgrVal = "ZERO"
dangleTolerance = 50
field = "VALUE"

# Execute RasterToPolygon
arcpy.RasterToPolyline_conversion(inRaster, outLines, backgrVal, 
                                  dangleTolerance, "SIMPLIFY", field)


Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes