Contour with Barriers (Spatial Analyst)

License Level:BasicStandardAdvanced

Summary

Creates contours from a raster surface. The inclusion of barrier features will allow you to independently generate contours on either side of a barrier.

Usage

Syntax

ContourWithBarriers (in_raster, out_contour_feature_class, {in_barrier_features}, {in_contour_type}, {in_contour_values_file}, {explicit_only}, {in_base_contour}, {in_contour_interval}, {in_indexed_contour_interval}, {in_contour_list}, {in_z_factor})
ParameterExplanationData Type
in_raster

The input surface raster.

Raster Layer
out_contour_feature_class

Output contour features.

Feature Class
in_barrier_features
(Optional)

Input barrier features.

Feature Layer
in_contour_type
(Optional)

The type of contour to create.

  • POLYLINES The contour or isoline representation of the input raster.
  • POLYGONS Closed polygons representing the contours.

The current version of Contour with Barriers only supports polyline output. If the polygon output option is used it will be ignored and polyline output will be created.

String
in_contour_values_file
(Optional)

The base contour, contour interval, indexed contour interval, and explicit contour values can also be specified via a text file.

File
explicit_only
(Optional)

Only explicit contour values are used. Base contour, contour interval, and indexed contour intervals are not specified.

  • NO_EXPLICIT_VALUES_ONLY The default, contour interval must be specified.
  • EXPLICIT_VALUES_ONLY Only explicit contour values are specified.
Boolean
in_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
in_contour_interval
(Optional)

The interval, or distance, between contour lines.

This can be any positive number.

Double
in_indexed_contour_interval
(Optional)

Contours will also be generated for this interval and will be flagged accordingly in the output feature class.

Double
in_contour_list
[in_explicit_contour,...]
(Optional)

Explicit values at which to create contours.

Double
in_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).

Double

Code Sample

ContourWithBarriers example 1 (Python window)

This example creates contours from an Esri Grid raster with an input barrier feature as well as base and interval parameters specified. The output contours area as polylines in a shapefile.

import arcpy
from arcpy import env  
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
ContourWithBarriers("elevation", "C:/sapyexamples/output/outcontourwithbarriers.shp", "elevation_barrier.shp", "POLYLINES",
                    "", "", 0, 300)
ContourWithBarriers example 2 (stand-alone script)

This example creates contours from an Esri Grid raster with an input barrier feature as well as base and interval parameters specified. The output contours area as polylines in a shapefile.

# Name: ContourWithBarriers_Ex_02.py
# Description: Creates contours from a raster surface.
#           The inclusion of barrier features will allow one to independently generate contours on either side of a barrier.
# 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"
inBarrier = "elevation_barrier.shp"
inTextFile = ""
explicitValues = "NO_EXPLICIT_VALUES_ONLY"
contourInterval = 200
contourList = [600, 935, 1237.4]
baseContour = 0
outContours = "C:/sapyexamples/output/outcontourwithbarriers02.shp"

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

# Execute Contour
ContourWithBarriers(inRaster, outContours, inBarrier, "POLYLINES", inTextFile, 
                    explicitValues, baseContour, contourInterval, "", 
                    contourList, "")

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Requires Spatial Analyst or 3D Analyst
ArcGIS for Desktop Standard: Requires Spatial Analyst or 3D Analyst
ArcGIS for Desktop Advanced: Requires Spatial Analyst or 3D Analyst
4/10/2014