Feature to Raster (Conversion)


Converts features to a raster dataset.



FeatureToRaster_conversion (in_features, field, out_raster, {cell_size})
ParameterExplanationData Type

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

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.

If the Shape field of a point or multipoint dataset contains z or m values, then either of these can be used.


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 a GRID raster format.

Raster Dataset

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

FeatureToRaster example 1 (Python window)

Converts features to a raster dataset.

import arcpy
from arcpy import env
env.workspace = "c:/data"
arcpy.FeatureToRaster_conversion("roads.shp", "CLASS", "c:/output/roadsgrid", 25)
FeatureToRaster example 2 (stand-alone script)

Converts features to a raster dataset.

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

# Import system modules
import arcpy
from arcpy import env

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

# Set local variables
inFeature = "roads.shp"
outRaster = "c:/output/roadsgrd"
cellSize = 25
field = "CLASS"

# Execute FeatureToRaster
arcpy.FeatureToRaster_conversion(inFeature, field, outRaster, cellSize)


Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes