Skip To Content

Polyline to Raster

Available with Advanced license.


Converts polyline features to a raster dataset.

Learn more about how the Polyline to Raster tool works


  • Any feature class (geodatabase, shapefile or coverage) containing polyline features can be converted to a raster dataset.

  • The input field type determines the type of output raster. If the field is integer, the output raster will be integer; if it is floating point, the output will be floating point.

    If the input field contains string values, the output raster will contain an integer value field and a string field.

  • This tool is a complement to the Raster to Polyline tool, which converts a raster to a polyline feature class.

  • When more than one feature is present in an output cell, this tool provides greater control over the assignment of cell values than the Feature to Raster tool.

  • Certain Raster storage environments may apply to this tool.

    • For the Pyramid environment settings, only the Build pyramids setting is honored. The remaining Pyramid environment settings are ignored. More control over the nature of the pyramids can be obtained in a subsequent step by using the Build Pyramids tool.

    • For the Compression environment settings, only the type of compression may be honored. This is only for raster formats other than Esri Grid.


PolylineToRaster_conversion (in_features, value_field, out_rasterdataset, {cell_assignment}, {priority_field}, {cellsize})
ParameterExplanationData Type

The polyline input feature dataset to be converted to a raster.

Feature Layer

The field used to assign values to the output raster.

It can be any field of the input feature dataset's attribute table.


The output raster dataset to be created.

When not saving to a geodatabase, specify .tif for a TIFF file format, .img for an ERDAS IMAGINE file format, or no extension for an Esri Grid raster format.

Raster Dataset

The method to determine how the cell will be assigned a value when more than one feature falls within a cell.

  • MAXIMUM_LENGTHThe feature with the longest length that covers the cell will determine the value to assign to the cell.
  • MAXIMUM_COMBINED_LENGTHIf there is more than one feature in a cell with the same value, the lengths of these features will be combined. The combined feature with the longest length within the cell will determine the value to assign to the cell.

This field is used to determine which feature should take preference over another feature that falls over a cell. When it is used, the feature with the largest positive priority is always selected for conversion irrespective of the Cell assignment type chosen.


The cell size for the output raster dataset.

The default cell size is the shortest of the width or height of the extent of the input feature dataset, in the output spatial reference, divided by 250.

Analysis Cell Size

Code sample

PolylineToRaster example 1 (Python window)

Converts polyline features to a raster dataset.

import arcpy
from arcpy import env
env.workspace = "c:/data"
arcpy.PolylineToRaster_conversion("roads.shp", "CLASS", "c:/output/roads.img",
                                   "MAXIMUM_COMBINED_LENGTH", "LENGTH", 30)
PolylineToRaster example 2 (stand-alone script)

Converts polyline features to a raster dataset.

# Name:
# Description: Converts polyline features to a raster dataset.

# Import system modules
import arcpy
from arcpy import env

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

# Set local variables
inFeatures = "roads.shp"
valField = "CLASS"
outRaster = "c:/output/roads.tif"
priorityField = "LENGTH"
cellSize = 30

# Execute PolylineToRaster
arcpy.PolylineToRaster_conversion(inFeatures, valField, outRaster, 
                                  assignmentType, priorityField, cellSize)

Licensing information

  • ArcGIS Desktop Basic: Requires Spatial Analyst or 3D Analyst
  • ArcGIS Desktop Standard: Requires Spatial Analyst or 3D Analyst
  • ArcGIS Desktop Advanced: Yes

Related topics