Generate Topographic Contours (Topographic Production)

摘要

Creates and smooths contours from an input raster.

使用情况

  • This tool supports local raster files only.

  • The Area of Interest, Input Rasters and Target Contour Features parameter values must use the same spatial reference.

  • If more than one input raster is used, all input rasters must have the same cell size, band count, and pixel type. All input rasters should also use the same elevation units (meters or feet).

  • The Area of Interest parameter value is used to limit the extent where the contours will be created. Typically, the Area of Interest parameter value will be a polygon feature that represents the extent of a map sheet at the specified scale. It will be buffered to ensure that contours extend to the full edge of the sheet and to reduce edge matching issues between sheets. Contours will only be created over the portions of the rasters that overlap with the extent of the buffered area of interest.

  • Use the Map Scale parameter to refine the appearance of the contours to be optimized for print and display at the specified scale. Specifying a scale sets the default contour values for several parameters based on the scale. The scale value also determines the minimum length of the contours and the smoothing tolerance that will be used to refine their appearance. When the scale and any of the parameters that calculate their default values from it are left blank, the tool will use the 1:50,000 scale to calculate the values.

    To clear contour values after they are automatically populated, choose the empty value at the top of the Map Scale drop-down list. Then choose the correct scale from the Map Scale parameter to repopulate the default contour values.

  • This tool also supports smoothing of the input rasters before creating the contour lines. When you set a Raster Smooth Tolerance parameter value, the tool uses theAdaptive Smoothing parameter from the Contour raster function to prepare the raster before generating contour lines. Depending on the tolerance used, the result can be contour lines that are smoother and more cartographically pleasing, but less accurate.

  • This tool does not create a new output feature class; it adds the contours to an existing feature class. Most topographic agencies have defined the feature class, subtypes, and attributes appropriate for describing their elevation features in their existing data schema. Rather than creating a new output that must be mapped to that schema as a postprocess, this tool will add the results directly to the specified feature class.

  • A base contour is used, for example, to create contours every 15 meters, starting at 10 meters. In this case, 10 is used for the base contour, and 15 is used for the contour interval. The values to be contoured are 10, 25, 40, and 55.

  • Specifying a base contour does not prevent contours from being created above or below that value.

  • If the Input Rasters parameter value contains an area with no data, such as a hole, the contours may intersect.

  • In addition to the contour elevation, you can populate the Contour Code Field parameter with information about the type of contour. When a Contour Code Field value is defined, use the following parameters to ensure that the field values are correctly populated:

    • Contour Index Interval—Distinguish index contours from intermediate contours.
    • Index Code—The value that will populate the Contour Code Field parameter value when the elevation of the contour is evenly divisible by the index interval and the contours are increasing in elevation.
    • Intermediate Code—The value that will populate the Contour Code Field parameter value when the elevation of the contour is not evenly divisible by the index interval and the contours are increasing in elevation.
    • Depression Code—The value that will populate the Contour Code Field parameter value when the elevation of the contour is evenly divisible by the index interval and the contours are decreasing in elevation.
    • Depression Intermediate Code—The value that will populate the Contour Code Field parameter value when the elevation of the contour is not evenly divisible by the index interval and the contours are decreasing in elevation.

  • The tool is supports various Defense Mapping data model schemas. If the feature class specified as the Out Contour Features value matches one of these schemas, the values for the Contour Height Field, Contour Subtype, Contour Code Field, Index Code, Intermediate Code, Depression Code, and Depression Intermediate Code parameters will automatically be set to the values appropriate for that schema.

  • The geometry of the contours can be further refined after they are created. Specifying a Contour Minimum Length parameter value will remove any isolated contours smaller than the specified length. For example, a contour line that encloses a peak but is only 10 meters long can be too short to be clearly visualized on a 1:100,000 scale map. Depending on the cell size of the input raster, the contour lines can have a coarse, blocky appearance. The Contour Smooth Tolerance parameter will apply a line smoothing algorithm to the contour lines to refine sharp angles and create smoother contours.

  • When using an input raster with elevation units in meters, map scales of 1:250,000 or smaller use a z-factor of 3.28084 to convert meters to feet. The resulting value is rounded up to the next highest 5-foot interval.

  • When using low-resolution input rasters, you can resample rasters to improve the contour output by checking the Resample Raster parameter. Generally, high-resolution input rasters do not need to be resampled.

  • Checking the Resample Raster parameter to process large Input Rasters values requires large amounts of disk space for processing.

  • Using a raster that only covers the target area helps lower processing times and mitigate memory issues. Smaller areas with a single raster take less computational effort to process than mosaics across a large area.

  • Do not resample a raster if its pixel depth is already high.

  • Use a midrange pixel depth if you are processing contours. Contour lines on a raster using a high pixel depth can cause issues. For example, if various loops or small tops with a 32-bit unsigned raster are visible, try using a 16-bit unsigned raster.

参数

标注说明数据类型
Input Rasters

The input raster layers that will be used to derive the contour lines.

Raster Layer; Mosaic Layer
Area of Interest

A feature layer that will be used to clip the input raster before processing. A buffer is created before clipping the raster, which results in larger output contours that extend beyond the selected area of interest. The feature layer must have only one selected feature.

Feature Layer
Target Contour Features

An existing line feature class or feature layer. Contours will be appended to this feature class.

Feature Layer
Contour Elevation Field

The field from the input contours that will store the contour elevation value. This field defaults to ZV2 or ZVH if a field with either of those names exists in the contour feature class.

Field
Contour Subtype
(可选)

The subtype to which contours will be written if the input contours have subtypes.

String
Map Scale
(可选)

Specifies the scale that will be used to optimize contours. This is the scale of the cartographic product that will be printed. Specifying the scale will set the defaults of other parameters to values that are appropriate for the output scale. The default is the 1:50,000 cartographic product scale.

  • 1:5,000The 1:5,000 cartographic product scale will be used.
  • 1:10,000The 1:10,000 cartographic product scale will be used.
  • 1:12,500The 1:12,500 cartographic product scale will be used.
  • 1:25,000The 1:25,000 cartographic product scale will be used.
  • 1:50,000The 1:50,000 cartographic product scale will be used. This is the default.
  • 1:100,000The 1:100,000 cartographic product scale will be used.
  • 1:250,000The 1:250,000 cartographic product scale will be used.
  • 1:500,000The 1:500,000 cartographic product scale will be used.
  • 1:1,000,000The 1:1,000,000 cartographic product scale will be used.
String
Resample Raster
(可选)

Specifies whether the input raster will be resampled before creating contours.

  • Checked—The input raster will be resampled before creating contours.
  • Unchecked—The input raster will not be resampled when creating contours. This is the default.
Boolean
Contour Interval
(可选)

The interval, or distance, between contour lines. This can be any positive number. The default is set by the scale value. If this parameter is left blank, the default scale value will be used.

Double
Base Contour
(可选)

The value that contours will be generated above and below to cover the entire value range of the input raster. The default is 0.

Double
Z Factor
(可选)

The unit conversion factor that will be used when generating contours. The default 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 that the ground x,y and surface z-units be consistent for this tool.

For example, if the elevation values in the input raster are in meters, but you want the contours to be generated in feet, set the z-factor to 3.28084 (1 meter = 3.28084 feet).

Double
Include Zero Contour
(可选)

Specifies whether a zero contour will be created. A zero contour represents sea level. Zero contours, when generated along a coastline, may be created inside a water body. Check this parameter if you want contours generated on land areas that are at or below sea level.

  • Checked—A zero contour will be created.
  • Unchecked—A zero contour will not be created. This is the default.
Boolean
Contour Code Field
(可选)

The field from the input contour feature class where the appropriate code will be stored. The field defaults to the HQC field if it exists in the input contour feature class.

Field
Contour Index Interval
(可选)

The interval, or distance, between index contour lines. For example, if the contour interval is 20 meters and you want index contours every 100 meters, specify 100. The default is set by the scale value.

Long
Index Code
(可选)

The code value that will be stored in the Contour Code Field parameter value when an index contour is identified. The default code will be 1 if the HQC field exists in the input contour feature class.

String
Intermediate Code
(可选)

The code value that will be stored in the Contour Code Field parameter value when an intermediate contour is identified. The default code will be 2 if the HQC field exists in the input contour feature class.

String
Depression Code
(可选)

The code value that will be stored in the Contour Code Field parameter value when a depression contour is identified. The default code will be 5 if the HQC field exists in the input contour feature class.

String
Depression Intermediate Code
(可选)

The code value that will be stored in the Contour Code Field parameter value when a depression intermediate contour is identified. The default code will be 6 if the HQC field exists in the input contour feature class.

String
Raster Smooth Tolerance
(可选)

The amount of smoothing that will be applied to the input raster before creating the contour lines.

Double
Contour Minimum Length
(可选)

The minimum length that will be used for an individual contour line. The default is set by the scale value. If the value is set to 0 or left blank, no contours will be deleted from the output contours based on their short length.

Linear Unit
Contour Smooth Tolerance
(可选)

The amount of smoothing that will be applied to the contour lines. The larger the value, the more generalized the contours. The default is set by the scale value. If this parameter is set to 0 or left blank, no smoothing will be applied to the output contours.

Linear Unit

派生输出

标注说明数据类型
Updated Contour Features

The output generated when features are added to the Target Contour Features parameter value.

Feature Layer

arcpy.topographic.GenerateTopographicContours(in_rasters, area_of_interest, contour_features, elevation_field, {contour_subtype}, {scale}, {resample_raster}, {contour_interval}, {base_contour}, {z_factor}, {zero_contour}, {code_field}, {index_interval}, {index_code}, {intermediate_code}, {depression_code}, {depression_intermediate_code}, {raster_smooth_tolerance}, {minimum_length}, {contour_smooth_tolerance})
名称说明数据类型
in_rasters
[in_rasters,...]

The input raster layers that will be used to derive the contour lines.

Raster Layer; Mosaic Layer
area_of_interest

A feature layer that will be used to clip the input raster before processing. A buffer is created before clipping the raster, which results in larger output contours that extend beyond the selected area of interest. The feature layer must have only one selected feature.

Feature Layer
contour_features

An existing line feature class or feature layer. Contours will be appended to this feature class.

Feature Layer
elevation_field

The field from the input contours that will store the contour elevation value. This field defaults to ZV2 or ZVH if a field with either of those names exists in the contour feature class.

Field
contour_subtype
(可选)

The subtype to which contours will be written if the input contours have subtypes.

String
scale
(可选)

Specifies the scale that will be used to optimize contours. This is the scale of the cartographic product that will be printed. Specifying the scale will set the defaults of other parameters to values that are appropriate for the output scale. The default is the 1:50,000 cartographic product scale.

  • 1:5,000The 1:5,000 cartographic product scale will be used.
  • 1:10,000The 1:10,000 cartographic product scale will be used.
  • 1:12,500The 1:12,500 cartographic product scale will be used.
  • 1:25,000The 1:25,000 cartographic product scale will be used.
  • 1:50,000The 1:50,000 cartographic product scale will be used. This is the default.
  • 1:100,000The 1:100,000 cartographic product scale will be used.
  • 1:250,000The 1:250,000 cartographic product scale will be used.
  • 1:500,000The 1:500,000 cartographic product scale will be used.
  • 1:1,000,000The 1:1,000,000 cartographic product scale will be used.
String
resample_raster
(可选)

Specifies whether the input raster will be resampled before creating contours.

  • RESAMPLE_RASTERThe input raster will be resampled before creating contours.
  • NO_RESAMPLE_RASTERThe input raster will not be resampled when creating contours. This is the default.
Boolean
contour_interval
(可选)

The interval, or distance, between contour lines. This can be any positive number. The default is set by the scale value. If this parameter is left blank, the default scale value will be used.

Double
base_contour
(可选)

The value that contours will be generated above and below to cover the entire value range of the input raster. The default is 0.

Double
z_factor
(可选)

The unit conversion factor that will be used when generating contours. The default 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 that the ground x,y and surface z-units be consistent for this tool.

For example, if the elevation values in the input raster are in meters, but you want the contours to be generated in feet, set the z-factor to 3.28084 (1 meter = 3.28084 feet).

Double
zero_contour
(可选)

Specifies whether a zero contour will be created. A zero contour represents sea level. Zero contours, when generated along a coastline, can be created inside a water body. Specify ZERO_CONTOUR if you want contours generated on land areas that are at or below sea level.

  • ZERO_CONTOURA zero contour will be created.
  • NO_ZERO_CONTOURA zero contour will not be created. This is the default.
Boolean
code_field
(可选)

The field from the input contour feature class where the appropriate code will be stored. The field defaults to the HQC field if it exists in the input contour feature class.

Field
index_interval
(可选)

The interval, or distance, between index contour lines. For example, if the contour interval is 20 meters and you want index contours every 100 meters, specify 100. The default is set by the scale value.

Long
index_code
(可选)

The code value that will be stored in the code_field parameter value when an index contour is identified. The default code will be 1 if the HQC field exists in the input contour feature class.

String
intermediate_code
(可选)

The code value that will be stored in the code_field parameter value when an intermediate contour is identified. The default code will be 2 if the HQC field exists in the input contour feature class.

String
depression_code
(可选)

The code value that will be stored in the code_field parameter value when a depression contour is identified. The default code will be 5 if the HQC field exists in the input contour feature class.

String
depression_intermediate_code
(可选)

The code value that will be stored in the code_field parameter value when a depression intermediate contour is identified. The default code will be 6 if the HQC field exists in the input contour feature class.

String
raster_smooth_tolerance
(可选)

The amount of smoothing that will be applied to the input raster before creating the contour lines.

Double
minimum_length
(可选)

The minimum length that will be used for an individual contour line. The default is set by the scale value. If the value is set to 0 or left blank, no contours will be deleted from the output contours based on their short length.

Linear Unit
contour_smooth_tolerance
(可选)

The amount of smoothing that will be applied to the contour lines. The larger the value, the more generalized the contours. The default is set by the scale value. If this parameter is set to 0 or left blank, no smoothing will be applied to the output contours.

Linear Unit

派生输出

名称说明数据类型
updated_contour_features

The output generated when features are added to the contour_features parameter value.

Feature Layer

代码示例

GenerateTopographicContours example 1 (stand-alone script)

The following stand-alone sample script demonstrates how to run the GenerateTopographicContours function with the default parameter values set by the scale specified.

# Name: GenerateTopographicContours_sample1.py
# Description: The Generate Topographic Contours tool creates contours that are
# appropriate for a cartographic product at a chosen scale. The following
# sample script demonstrates how to use Generate Topographic Contours to create
# contours appropriate for a 1:50,000 scale product using all the default values
# defined by the tool.

# Import System Modules
import arcpy

# Check Out Extensions
arcpy.CheckOutExtension('Foundation')
arcpy.CheckOutExtension('Spatial')

# Setting Local Variables
in_raster = r'C:\Data\Monterey.dt2'
aoi_fc = r'C:\Data\MapIndex.gdb\MapIndex\TLM50_Index'
contour_features = r'C:\Data\MGCP_TRD_4_4.gdb\MGCP_Delta\ContourL'
contour_subtype = 'CA010_Elevation_Contour_Line'
elevation_field = 'Highest Elevation'

# Create feature layer for area of interest and select a single feature based on the NRN field
aoi_layer = arcpy.management.MakeFeatureLayer(aoi_fc, 'aoi_layer')
arcpy.management.SelectLayerByAttribute(aoi_layer, 'NEW_SELECTION', "NRN = 'V795X16573'")

# Calling Generate Topographic Contours to create contours
arcpy.topographic.GenerateTopographicContours(in_raster, aoi_layer, contour_features, elevation_field, contour_subtype)

# Check In Extensions
arcpy.CheckInExtension('Foundation')
arcpy.CheckInExtension('Spatial')
GenerateTopographicContours example 2 (stand-alone script)

The following stand-alone sample script demonstrates how to run the GenerateTopographicContours function with the default parameter values overwritten.

# Name: GenerateTopographicContours_sample2.py
# Description: The Generate Topographic Contours tool creates contours that are
# appropriate for a cartographic product at a chosen scale. The following
# sample script demonstrates how to use Generate Topographic Contours to create
# contours appropriate for a 1:24,000 scale product using the 1:25,000 map
# scale value and overriding some of the default values.

# Import System Modules
import arcpy

# Check Out Extensions
arcpy.CheckOutExtension('Foundation')
arcpy.CheckOutExtension('Spatial')

# Set Local Variables
in_raster = r'C:\Data\Monterey.dt2'
aoi_fc = r'C:\Data\MapIndex.gdb\TOPO24K'
contour_features = r'C:\Data\Topo.gdb\Elev_Contour'
contour_subtype = '#'
elevation_field = 'ContourElevation'
scale = '1:25,000'
resample = 'RESAMPLE_RASTER'

# Default value for 1:25,000 scale is 10 m contours, change to 20 ft
contour_interval = 20
base_contour = 0

# Raster elevation is in meters, apply z_factor to get elevation in feet
z_factor = 3.2808
include_zero = 'ZERO_CONTOUR'

# Define the contour code field and values
code_field = 'FCODE'
index_interval = 100
index_code = '10102'
intermediate_code = '10101'
depression_code = '10105'
depression_intermediate_code = '10104'

# Adjust contour refinement values
raster_smooth = 0.2
minimum_length = '100 Feet'
contour_smooth = '25 Feet'

# Create feature layer for area of interest and select a single feature based on the Quad_Name field
aoi_layer = arcpy.management.MakeFeatureLayer(aoi_fc, 'aoi_layer')
arcpy.management.SelectLayerByAttribute(aoi_layer, 'NEW_SELECTION', "QUAD_NAME = 'Big Sur'")

# Call Generate Topographic Contours to create contours
arcpy.topographic.GenerateTopographicContours(in_raster, aoi_layer, contour_features, elevation_field, contour_subtype, 
                                              scale, resample, contour_interval, base_contour, z_factor, include_zero, 
                                              code_field, index_interval, index_code, intermediate_code, depression_code, 
                                              depression_intermediate_code, raster_smooth, minimum_length, contour_smooth)

# Check In Extensions
arcpy.CheckInExtension('Foundation')
arcpy.CheckInExtension('Spatial')

环境

此工具不使用任何地理处理环境。

许可信息

  • Basic: 否
  • Standard: 否
  • Advanced: 需要 Production Mapping and ArcGIS Spatial Analyst extension

相关主题