Contour List (Spatial Analyst)
Summary
Creates a feature class of selected contour values from a raster surface.
Usage
-
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.
-
The contour values do not need to be sorted in order.
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.
If the output extent is changed from default, Resampling of the input raster may occur. To avoid this, and to ensure consistent results, set the Snap Raster equal to the input raster.
When the input raster needs to be resampled, the Bilinear technique will be used. An example of when an input raster may be resampled is when the output coordinate system, extent, or cell size is different from that of the input.
Syntax
Parameter | Explanation | Data Type |
in_raster |
The input surface raster. | Raster Layer |
out_polyline_features |
Output contour polyline features. | Feature Class |
contour_values [contour_value,...] |
List of z-values for which to create contours. | Double |
Code Sample
This example creates contours for three elevation values 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"
ContourList("elevation", "C:/sapyexamples/output/outcontourlist.shp", [600, 935, 1237.4])
This example creates contours for three elevation values from an Esri Grid raster and outputs them as a shapefile.
# Name: ContourList_Ex_02.py
# Description: CCreates contours or isolines based on a list of contour values.
# Requirements: Spatial Analyst Extension
# 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"
contourIntervalList = [600, 935, 1237.4]
outContours = "C:/sapyexamples/output/outcontourlist02.shp"
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute ContourList
ContourList(inRaster, outContours, contourIntervalList)