Parameters
Label | Explanation | Data Type |
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 (Optional) | The subtype to which contours will be written if the input contours have subtypes. | String |
Map Scale (Optional) | 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 1:50,000.
| String |
Resample Raster (Optional) | Specifies whether the input raster will be resampled before creating contours.
| Boolean |
Contour Interval (Optional) | 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 (Optional) | 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 (Optional) | 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 (Optional) | 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.
| Boolean |
Contour Code Field (Optional) | The field from the input contour feature class where the appropriate code will be stored. The default field is HQC if it exists in the input contour feature class. | Field |
Contour Index Interval (Optional) | 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 (Optional) | The code value that will be stored in the Contour Code Field parameter value when an index contour is identified. The default code is 1 if the HQC field exists in the input contour feature class. | String |
Intermediate Code (Optional) | The code value that will be stored in the Contour Code Field parameter value when an intermediate contour is identified. The default code is 2 if the HQC field exists in the input contour feature class. | String |
Depression Code (Optional) | The code value that will be stored in the Contour Code Field parameter value when a depression contour is identified. The default code is 5 if the HQC field exists in the input contour feature class. | String |
Depression Intermediate Code (Optional) | The code value that will be stored in the Contour Code Field parameter value when a depression intermediate contour is identified. The default code is 6 if the HQC field exists in the input contour feature class. | String |
Raster Smooth Tolerance (Optional) | The amount of smoothing that will be applied to the input raster before creating the contour lines. | Double |
Contour Minimum Length (Optional) | 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 (Optional) | 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 |
Supplemental Contours (Optional) | Specifies the interval at which a contour line will be placed between regularly spaced contours. This is used when the terrain change is not large enough to be depicted with consistent contour intervals.
| String |
Half Auxiliary Code (Optional) | The code value that will be stored in the Contour Code Field parameter value when a half auxiliary contour is identified. The default code is 3 if the HQC field exists in the input contour feature class. | String |
Quarter Auxiliary Code (Optional) | The code value that will be stored in the Contour Code Field parameter value when a quarter auxiliary contour is identified. The default code is 14 if the HQC field exists in the input contour feature class | String |
Depression Auxiliary Code (Optional) | The code value that will be stored in the Contour Code Field parameter value when a depression auxiliary contour is identified. The default code is 22 if the HQC field exists in the input contour feature class. | String |
Derived Output
Label | Explanation | Data Type |
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}, {supplemental_contours}, {half_auxiliary_code}, {quarter_auxiliary_code}, {depression_auxiliary_code})
Name | Explanation | Data Type |
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 (Optional) | The subtype to which contours will be written if the input contours have subtypes. | String |
scale (Optional) | 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 1:50,000.
| String |
resample_raster (Optional) | Specifies whether the input raster will be resampled before creating contours.
| Boolean |
contour_interval (Optional) | 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 (Optional) | 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 (Optional) | 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 (Optional) | 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.
| Boolean |
code_field (Optional) | The field from the input contour feature class where the appropriate code will be stored. The default field is HQC if it exists in the input contour feature class. | Field |
index_interval (Optional) | 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 (Optional) | The code value that will be stored in the code_field parameter value when an index contour is identified. The default code is 1 if the HQC field exists in the input contour feature class. | String |
intermediate_code (Optional) | The code value that will be stored in the code_field parameter value when an intermediate contour is identified. The default code is 2 if the HQC field exists in the input contour feature class. | String |
depression_code (Optional) | The code value that will be stored in the code_field parameter value when a depression contour is identified. The default code is 5 if the HQC field exists in the input contour feature class. | String |
depression_intermediate_code (Optional) | The code value that will be stored in the code_field parameter value when a depression intermediate contour is identified. The default code is 6 if the HQC field exists in the input contour feature class. | String |
raster_smooth_tolerance (Optional) | The amount of smoothing that will be applied to the input raster before creating the contour lines. | Double |
minimum_length (Optional) | 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 (Optional) | 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 |
supplemental_contours (Optional) | Specifies the interval at which a contour line will be placed between regularly spaced contours. This is used when the terrain change is not large enough to be depicted with consistent contour intervals.
| String |
half_auxiliary_code (Optional) | The code value that will be stored in the code_field parameter value when a half auxiliary contour is identified. The default code is 3 if the HQC field exists in the input contour feature class. | String |
quarter_auxiliary_code (Optional) | The code value that will be stored in the code_field parameter value when a quarter auxiliary contour is identified. The default code is 14 if the HQC field exists in the input contour feature class. | String |
depression_auxiliary_code (Optional) | The code value that will be stored in the code_field parameter value when a depression auxiliary contour is identified. The default code is 22 if the HQC field exists in the input contour feature class. | String |
Derived Output
Name | Explanation | Data Type |
updated_contour_features | The output generated when features are added to the contour_features parameter value. | Feature Layer |
Code sample
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 Modulesimport arcpy# Check Out Extensionsarcpy.CheckOutExtension('Foundation')arcpy.CheckOutExtension('Spatial')# Setting Local Variablesin_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 fieldaoi_layer = arcpy.management.MakeFeatureLayer(aoi_fc, 'aoi_layer')arcpy.management.SelectLayerByAttribute(aoi_layer, 'NEW_SELECTION', "NRN = 'V795X16573'")# Calling Generate Topographic Contours to create contoursarcpy.topographic.GenerateTopographicContours(in_raster, aoi_layer, contour_features, elevation_field, contour_subtype)# Check In Extensionsarcpy.CheckInExtension('Foundation')arcpy.CheckInExtension('Spatial')
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 Modulesimport arcpy# Check Out Extensionsarcpy.CheckOutExtension('Foundation')arcpy.CheckOutExtension('Spatial')# Set Local Variablesin_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 ftcontour_interval = 20base_contour = 0# Raster elevation is in meters, apply z_factor to get elevation in feetz_factor = 3.2808include_zero = 'ZERO_CONTOUR'# Define the contour code field and valuescode_field = 'FCODE'index_interval = 100index_code = '10102'intermediate_code = '10101'depression_code = '10105'depression_intermediate_code = '10104'# Adjust contour refinement valuesraster_smooth = 0.2minimum_length = '100 Feet'contour_smooth = '25 Feet'# Create feature layer for area of interest and select a single feature based on the Quad_Name fieldaoi_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 contoursarcpy.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 Extensionsarcpy.CheckInExtension('Foundation')arcpy.CheckInExtension('Spatial')