表面坡度 (3D Analyst)
插图
用法
-
使用类别明细表参数可将坡度信息限制为输出要素类的特定间隔。
可通过类别明细表(最多包含两列)提供自定义的坡度分类。第一列始终指示分类明细值。第二列如果可用,则将用于定义坡度分类所对应的代码。考虑以下示例:
类别明细
CODE
10.0
1
25.0
2
40.0
3
70.0
4
该表可以是任何受支持的格式(.dbf、.txt 或地理数据库表)。字段的名称不重要,因为第一个始终用于类明细,第二个始终用于坡向编码。
-
仅当使用类别明细表时才会应用单位。
语法
参数 | 说明 | 数据类型 |
in_surface |
输入 terrain 或 TIN 数据集。 | Tin Layer; Terrain Layer |
out_feature_class |
The output feature class. | Feature Class |
units (可选) |
The units of measure to be used in calculating slope.
| String |
class_breaks_table (可选) |
包含分类明细的表格,将用于分类输出要素。此表格的第一列将指示中断点,而第二列将提供分类代码。 | Table |
slope_field (可选) |
包含坡度值的字段。 | String |
z_factor (可选) |
The factor by which elevation values will be multiplied. This is typically used to convert Z linear units that match those of the XY linear units. The default is 1, which leaves elevation values unchanged. | Double |
pyramid_level_resolution (可选) |
The z-tolerance or window size resolution of the terrain pyramid level that will be used by this tool. The default is 0, or full resolution. | Double |
代码示例
The following sample demonstrates the use of this tool in the Python window:
import arcpy from arcpy import env arcpy.CheckOutExtension("3D") env.workspace = "C:/data" arcpy.SurfaceSlope_3d("sample.gdb/featuredataset/terrain", "s_slope.shp", "PERCENT")
The following sample demonstrates the use of this tool in a stand-alone Python script:
'''**************************************************************************** Name: SurfaceSlope Example Description: This script demonstrates how to use the SurfaceAspect and SurfaceSlope tools to generate a polygon that contains the intersection of both ****************************************************************************''' # Import system modules import arcpy from arcpy import env # Obtain a license for the ArcGIS 3D Analyst extension arcpy.CheckOutExtension("3D") # Set environment settings env.workspace = "C:/data" try: # List all TINs in workspace listTINs = arcpy.ListDatasets("","TIN") # Determine whether the list contains any TINs if len(listTINs) > 0: for dataset in listTINs: print dataset # Set Local Variables aspect = arcpy.CreateUniqueName("Aspect.shp") slope = arcpy.CreateUniqueName("Slope.shp") outFC = dataset + "_Aspect_Slope.shp" #Execute SurfaceAspect arcpy.SurfaceAspect_3d(dataset, aspect) #Execute SurfaceSlope arcpy.SurfaceSlope_3d(dataset, slope) #Execute SurfaceSlope print "Starting Intersect" arcpy.Intersect_analysis(aspect + " #;" + slope + " #", outFC, "ALL") print "Completed intersect for " + dataset del aspect, slope, outFC else: print "There are no TINs in the " + env.workspace + " directory." except: # Returns any other error messages print arcpy.GetMessages(2) del arcpy, listTINs