Label | Explanation | Data Type |
Input Raster | The input surface raster. | Raster Layer; Raster Dataset; Mosaic Layer; Mosaic Dataset |
Output Contour Features | The output contour features. | Feature Class |
Input Barrier Features (Optional) | The input barrier features. The features can be polyline or polygon type. | Feature Layer |
Type of Contours (Optional) | The type of contour to create.
| String |
File Containing Contour Value Specifications (Optional) | The base contour, contour interval, indexed contour interval, and explicit contour values can also be specified via a text file. | File |
Enter Explicit Contour Values Only (Optional) | Only explicit contour values are used. Base contour, contour interval, and indexed contour intervals are not specified.
| Boolean |
Base Contour (Optional) | 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. | Double |
Contour Interval (Optional) | The interval, or distance, between contour lines. This can be any positive number. | Double |
Indexed Contour Interval (Optional) | Contours will also be generated for this interval and will be flagged accordingly in the output feature class. | Double |
Explicit Contour Values (Optional) | Explicit values at which to create contours. | Double |
Factor Applied to Raster Z-values (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 unit other than that of the z-values, set an appropriate value for the z-factor. 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). | Double |
Available with Spatial Analyst license.
Available with 3D Analyst license.
Summary
Creates contours from a raster surface. The inclusion of barrier features allows you to independently generate contours on either side of a barrier.
Usage
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.
If you have the ArcGIS Spatial Analyst extension available, 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.
Contours will extend into the raster's NoData cell by a distance of half the raster's cell size. This will mean that the contours will be generated over single NoData cells. However, a 3-cell-by-3-cell area of NoData will only have the contours extending into this area by half the cell size distance.
The Type field in the output contour feature class can have values such as:
1 for contours 2 for indexed contours 3 for explicit contours
An indexed contour interval can be used to generate additional contours and their Type value will be coded as 2 in the output feature class.
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.
A text file containing contour value specifications can include the following:
- Any line that starts with a non-numeric value will be ignored and treated as a comment line.
- A line with a single value will be treated as an explicit contour value.
- A line with three values will be treated as base, contour interval, and indexed contour.
- A line with four values will treated as from, to, by, and indexed contours.
For example, if a raster has a minimum value of 102 and a maximum of 500, then a text file with:
# contour values and ranges 122.75 485 500 5 12 4 100 99
will produce contours at:
122.75 104, 204, 304, 404 103, 202, 301, 400, 499 485, 490, 495, 500 497
If there are cell values of the raster within a barrier polygon feature the contour lines will be split at the barrier. If the cell values within the polygon feature are to be ignored, change those cell values to NoData.
If the input raster surface is very large or many output features are requested, a large number of temporary files will be created in the operating system's temporary file location. If any problems are encountered as a result of this do one of the following:
- Increase the available disk space for temporary files.
- Reduce the number of contours specified, or split the contour range up and process each group separately, and combine the results from each range into a final result.
- Process the input data in sections (tiles), and merge the individual results into one dataset.
Parameters
arcpy.ddd.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})
Name | Explanation | Data Type |
in_raster | The input surface raster. | Raster Layer; Raster Dataset; Mosaic Layer; Mosaic Dataset |
out_contour_feature_class | The output contour features. | Feature Class |
in_barrier_features (Optional) | The input barrier features. The features can be polyline or polygon type. | Feature Layer |
in_contour_type (Optional) | The type of contour to create.
Note:The current version of this tool 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.
| Boolean |
in_base_contour (Optional) | 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. | 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 unit other than that of the z-values, set an appropriate value for the z-factor. 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). | Double |
Code sample
This example creates contours from an Esri Grid raster by incorporating an input barrier feature. The base and interval parameters are also specified. The output contours are polylines in a shapefile.
import arcpy
from arcpy import env
env.workspace = "C:/data"
arcpy.ContourWithBarriers_3d("elevation", "C:/output/outcwb.shp",
"elevation_barrier.shp", "POLYLINES", "", "", 0, 300)
This example creates contours from an Esri Grid raster by incorporating an input barrier feature. The base and interval parameters are also specified. The output contours are polylines in a shapefile.
# Name: ContourWithBarriers_3d_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: 3D Analyst Extension
# Import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "C:/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:/output/outcwb.shp"
# Execute Contour
arcpy.ContourWithBarriers_3d(inRaster, outContours, inBarrier, "POLYLINES",
inTextFile, explicitValues, baseContour,
contourInterval, "", contourList, "")
Environments
Licensing information
- Basic: Requires 3D Analyst or Spatial Analyst
- Standard: Requires 3D Analyst or Spatial Analyst
- Advanced: Requires 3D Analyst or Spatial Analyst