ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Raster to Polyline

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Converts a raster dataset to polyline features.

Usage

  • The input raster can have any valid cell size greater than 0, and may be any 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 Grid_code 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 polyline 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

Syntax

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

The input raster dataset.

The raster must be integer type.

Raster Layer
out_polyline_features

The output feature class that will contain the converted polylines.

Feature Class
background_value
(Optional)

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.

  • ZERO —The background is composed of cells of zero or less or NoData. All cells with a value greater than zero are considered a foreground value.
  • NODATA —The background is composed of NoData cells. All cells with valid values belong to the foreground.
String
minimum_dangle_length
(Optional)

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

Double
simplify
(Optional)

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

  • SIMPLIFY —The polylines will be simplified into simpler shapes such that each contains a minimum number of segments. This is the default.
  • NO_SIMPLIFY —The polylines will not be simplified.
Boolean
raster_field
(Optional)

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.

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)

Environments

  • Auto Commit
  • Current Workspace
  • Default Output Z Value
  • Extent
  • Geographic Transformations
  • M Resolution
  • M Tolerance
  • Maintain Spatial Index
  • Output CONFIG Keyword
  • Output Coordinate System
  • Output has M values
  • Output has Z values
  • Output M Domain
  • Output XY Domain
  • Output Z Domain
  • Scratch Workspace
  • Snap Raster
  • XY Resolution
  • XY Tolerance
  • Z Resolution
  • Z Tolerance

Licensing information

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

Related topics

  • About converting from raster data
  • Polyline to Raster

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal