Contour (Spatial Analyst)

Summary

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

Learn more about how Contouring works

Usage

Syntax

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

The input surface raster.

Raster Layer
out_polyline_features

Output contour polyline features.

Feature Class
contour_interval

Interval of contours.

This can be any positive number.

Double
base_contour
(Optional)

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.

Double
z_factor
(Optional)

Number of ground x,y units in one surface z unit.

The z-factor adjusts the units of measure for the z units when they are different from the x,y units of the input surface. The z-values of the input surface are multiplied by the z-factor when calculating the final output surface.

If the x,y units and z units are in the same units of measure, the z-factor is 1. This is the default.

If the x,y units and z units are in different units of measure, the z-factor must be set to the appropriate factor, or the results will be incorrect. For example, if your z units are feet and your x,y units are meters, you would use a z-factor of 0.3048 to convert your z units from feet to meters (1 foot = 0.3048 meter).

Double

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 arcpy.sa 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: Contour_Ex_02.py
# Description: Creates contours or isolines from a raster surface.
# Requirements: Spatial Analyst Extension
# Author: ESRI

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

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

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

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

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

Environments

Related Topics

Licensing Information

ArcView: Requires Spatial Analyst or 3D Analyst
ArcEditor: Requires Spatial Analyst or 3D Analyst
ArcInfo: Requires Spatial Analyst or 3D Analyst

6/29/2011