描述
Creates elevation point features based on contour tops and depressions. Elevation points are created in each top and depression. Point height values are populated based on a digital elevation model.
使用方法
This tool creates multiple points in areas with tops or depressions that have elevations of the same value. For example, if the tool finds two identical elevation values in different locations in the same top, it generates a point at each location.
A top refers to an elevation completely surrounded by lower elevation contour lines. A depression refers to an elevation completely surrounded by higher elevation contour lines.
Tops and depressions must be polylines that start and end at the same vertex. The tool will not create spot heights over contour lines that do not start and end at the same vertex.
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).
语法
arcpy.topographic.GenerateSpotHeights(in_contour_features, in_raster, target_spot_features, contour_height_field, spot_height_field, spot_height_subtype, {area_of_interest})
参数 | 说明 | 数据类型 |
in_contour_features | Contours from which spot heights are computed. | Feature Layer |
in_raster [in_raster,...] | Rasters used to derive the highest or lowest elevations in contour tops or depressions. | Raster Layer; Mosaic Layer |
target_spot_features | An existing point feature layer or feature class in which spot heights are created. | Feature Layer |
contour_height_field | The field in the input contours that contains elevation values. The field type must be numeric. | Field |
spot_height_field | The field in the output spot heights to which elevation values are written. | Field |
spot_height_subtype | Spot height subtype value assigned to new spot height features that are created. | String |
area_of_interest (可选) | The extent where spot heights will be created. The area of interest (AOI) is the outer extent of all selected polygons in the feature layer. If none are selected, the extent of the raster will be used. This parameter does not accept point layers as valid input. | Feature Layer |
派生输出
名称 | 说明 | 数据类型 |
updated_spot_features | Spot height feature class where spot features were created. | Feature Layer |
代码示例
This Python stand-alone sample code creates elevation point features based on contour tops and depressions.
# Name: GenerateSpotHeights_sample.py
# Description: Creates elevation point features based on contour tops and depressions
# Import System Modules
import arcpy
# Check Out Extensions
arcpy.CheckOutExtension('Defense')
# Setting the environment
arcpy.env.overwriteOutput = True
# Setting Local Variables
input_contours = r'C:\Data\MGCP_TRD_4_4.gdb\MGCP_Delta\ContourL'
input_rasters = r'C:\Data\Monterey.dt2'
target_spot_features = r'C:\Data\MGCP_TRD_4_4.gdb\MGCP_Delta\ElevP'
contour_height_field = 'ZVH'
spot_height_field = 'ZVH'
spot_height_subtype = 'CA040_Spot_Elevation_Point'
area_of_interest_feature_class = r'C:\Data\MapIndex.gdb\MapIndex\TLM50_Index'
# Making a feature layer from the Area of Interest features, and selecting a single feature based on the NRN field
arcpy.management.MakeFeatureLayer(area_of_interest_feature_class, 'AOI_Index')
arcpy.management.SelectLayerByAttribute('AOI_Index', 'NEW_SELECTION', "NRN = 'V795X16573'")
# Calling the Generate Spot Heights to creating spot heights for AOI
arcpy.topographic.GenerateSpotHeights(input_contours, input_rasters, target_spot_features, contour_height_field, spot_height_field, spot_height_subtype, 'AOI_Index')
# Getting all messages, warnings, and errors from the tool run and printing the results back to the user
messages = arcpy.GetMessages(0)
warnings = arcpy.GetMessages(1)
errors = arcpy.GetMessages(2)
arcpy.AddMessage('Tool Messages: {}\nTool Warnings: {}\nTool Errors{}\n'.format(messages, warnings, errors))
# Check In Extensions
arcpy.CheckInExtension('Defense') # Check in any extensions that were checked out earlier in the script
环境
许可信息
- Basic: 否
- Standard: 否
- Advanced: 需要 Production Mapping and ArcGIS Spatial Analyst 扩展模块