Skip To Content


Available with Spatial Analyst license.

Available with 3D Analyst license.


Creates a line feature class of contours (isolines) from a raster surface.

Learn more about how Contouring works


  • Contours do not extend beyond the spatial extent of the raster, and they are not generated in areas of NoData; therefore, adjacent contour inputs should first be edgematched into a continuous feature dataset. As an alternative to edgematching, you can merge the adjacent rasters before computing contours.

  • Contours can be generated in areas of negative raster values. The contour values will be negative in such areas. Negative contour intervals are not allowed.

  • Smoother but less accurate contours can be obtained by preprocessing the input raster with a Focal Statistics operation with the Mean option or the Filter tool with the Low option.

  • A base contour is used, for example, when you want to create contours every 15 meters, starting at 10 meters. Here, 10 would be used for the base contour, and 15 would be the contour interval. The values to be contoured would be 10, 25, 40, 55, and so on.

  • Specifying a base contour does not prevent contours from being created above or below that value.

  • If Extent is specified in the environment setting, and the lower-left corner of the output extent does not match with any cell corner of the input raster, in the processing a shift of the cell alignment of the input raster will be performed to match the specified extent. This shift will trigger a resampling of the input raster using the Bilinear method. Consequently, the output features will be shifted as well, and as a result the output features may not overlay the original input raster exactly. You can avoid this shift by using the input raster as the Snap Raster in the environment.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.


Contour (in_raster, out_polyline_features, contour_interval, {base_contour}, {z_factor})
ParameterExplanationData Type

The input surface raster.

Raster Layer

The output contour polyline features.

Feature Class

The interval, or distance, between contour lines.

This can be any positive number.


The base contour value.

Contours are generated above and below this value as needed to cover the entire value range of the input raster. The default is zero.


The unit conversion factor used when generating contours. The default value is 1.

The contour lines are generated based on the z-values in the input raster, which are often measured in units of meters or feet. With the default value of 1, the contours will be in the same units as the z-values of the input raster. To create contours in a different unit than that of the z-values, set an appropriate value for the z-factor. Note that it is not necessary to have the ground x,y and surface z-units be consistent for this tool.

For example, if the elevation values in your input raster are in feet, but you want the contours to be generated based on units of meters, set the z-factor to 0.3048 (since 1 foot = 0.3048 meter).

For another example, consider an input raster in WGS_84 geographic coordinates and elevation units of meters for which you want to generate contour lines every 100 feet with a base of 50 feet (so the contours will be 50 ft, 150 ft, 250 ft, and so on). To do this, set the contour_interval to 100, the base_contour to 50, and the z_factor to 3.2808 (since 1 meter = 3.2808 feet).


Code sample

Contour example 1 (Python window)

This example creates contours from an Esri Grid raster and outputs them as a shapefile.

import arcpy
from arcpy import env  
from import *
env.workspace = "C:/sapyexamples/data"
Contour("elevation", "C:/sapyexamples/output/outcontours.shp", 200, 0)
Contour example 2 (stand-alone script)

This example creates contours from an Esri Grid raster and outputs them as a shapefile.

# Name:
# Description: Creates contours or isolines from a raster surface.
# Requirements: Spatial Analyst Extension

# Import system modules
import arcpy
from arcpy import env
from import *

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

# Set local variables
inRaster = "elevation"
contourInterval = 200
baseContour = 0
outContours = "C:/sapyexamples/output/outcontours02.shp"

# Execute Contour
Contour(inRaster, outContours, contourInterval, baseContour)

Licensing information

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

Related topics