Contour (3D Analyst)

Summary

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

Learn more about how Contouring works

Usage

Syntax

Contour_3d (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

The interval, or distance, between contour lines.

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)

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 ft = 0.3048 m).

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 1m = 3.2808 ft).

Double

Code Sample

Contour example 1 (Python window)

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

import arcpy
from arcpy import env  
env.workspace = "C:/data"
arcpy.Contour_3d("elevation", "C:/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_3d_Ex_02.py
# Description: Creates contours or isolines from a raster surface.
# Requirements: 3D Analyst Extension

# Import system modules
import arcpy
from arcpy import env

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

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

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

# Execute Contour
arcpy.Contour_3d(inRaster, outContours, contourInterval, baseContour)

Environments

Related Topics

Licensing Information

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

6/10/2013