添加表面信息 (3D 分析)
摘要
为点、多点和折线要素插入表面高程属性。
用法
忽略 3D 要素类的 Z 值。所有要素均视为二维要素。
-
输出属性选项被写入到输入要素类的属性表,该属性依赖于要素的几何。下表汇总了可用于各种支持的几何类型的选项:
- 点 - z 值
- 多点 - z 最小值、z 最大值、z 平均值
- 折线 - z 最小值、z 最大值、z 平均值、表面长度、最小坡度、最大坡度、平均坡度
-
线要素的坡度值将针对各线段计算得出,以百分比或度数表示。
- 最小坡度根据值最接近 0 或水平度的线段获得。
- 最大坡度根据具有最大计算值的线段获得。
- 平均坡度通过按 3D 长度对每条线段进行加权后,对所有线段的坡度求平均值获得。这会导致较长线段对结果值的影响比较短线段更大。
语法
参数 | 说明 | 数据类型 |
in_feature_class |
输入点、多点或折线要素类。 | Feature Layer |
in_surface |
The raster, TIN, or terrain surface used for interpolating z-values. | Raster Layer; Terrain Layer; TIN Layer |
out_property | 将添加到输入要素类属性表中的表面高程属性。下表汇总了可用属性关键字及其支持的几何类型:
| String |
method (可选) |
用于确定输入要素的 Z 值的插值方法。可用选项有:
| String |
sample_distance (可选) |
用于内插 z 值的间距。默认情况下,如果输入表面是栅格,则使用栅格像元大小;如果输入是 terrain 或 TIN 数据集,则使用三角化网格面的自然增密。 | Double |
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.AddSurfaceInformation_3d("points.shp", "my_tin", "Z", "LINEAR")
The following sample demonstrates the use of this tool in a stand-alone Python script:
'''********************************************************************* Name: AddSurfaceInformation Example Description: This script demonstrates how to use AddSurfaceInformation on all 2D feature classes in a target workspace. *********************************************************************''' # Import system modules import arcpy from arcpy import env import exceptions, sys, traceback try: arcpy.CheckOutExtension("3D") # Set Local Variables env.workspace = 'c:/data' inSurface = 'fgdb.gdb/municipal/terrain' pyramid = 5 method = "BILINEAR" # Create list of feature classes fcList = arcpy.ListFeatureClasses() if fcList: for fc in fcList: desc = arcpy.Describe(fc) # Determine if the feature is 2D if not desc.hasZ: if desc.shapeType == "Polygon": # Desired properties separated by semi-colons Prop = "Z_MIN;Z_MAX" elif desc.shapeType == "Point": Prop = "Z" elif desc.shapeType == "Multipoint": Prop = "Z_MIN;Z_MAX;Z_MEAN" elif desc.shapeType == "Polyline": Prop = "LENGTH_3D" # Execute AddSurfaceInformation arcpy.ddd.AddSurfaceInformation(fc, inSurface, Prop, method, 15, 1, pyramid) print "Completed adding surface information." arcpy.CheckInExtension('3D') except arcpy.ExecuteError: print arcpy.GetMessages() except: # Get the traceback object tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] # Concatenate error information into message string pymsg = 'PYTHON ERRORS:\nTraceback info:\n{0}\nError Info:\n{1}'\ .format(tbinfo, str(sys.exc_info()[1])) msgs = 'ArcPy ERRORS:\n {0}\n'.format(arcpy.GetMessages(2)) # Return python error messages for script tool or Python Window arcpy.AddError(pymsg) arcpy.AddError(msgs)