需要 3D Analyst 许可。
摘要
向 terrain 数据集引用的点要素追加点。
用法
此工具将使 terrain 数据集失效。请在添加点或多点后运行构建 Terrain。
如果 terrain 位于 SDE 中,则必须将其注册为版本。
语法
AppendTerrainPoints_3d (in_terrain, terrain_feature_class, in_point_features, {polygon_features_or_extent})
参数 | 说明 | 数据类型 |
in_terrain | 待处理的 terrain 数据集。 | Terrain Layer |
terrain_feature_class | 要添加点或多点的 terrain 数据集的构成要素类。 此参数只需要要素类的名称,不需要完整路径。 | String |
in_point_features | 要添加为 terrain 数据集的附加数据源的点或多点的要素类。 | Feature Layer |
polygon_features_or_extent (可选) | 指定用于定义要添加点要素的区域的面要素类或 arcpy.Extent 对象。默认情况下此参数为空,这样输入要素类的所有点都将被加载到 terrain 要素中。 | Extent; Feature Layer |
代码实例
AppendTerrainPoints 示例 1(Python 窗口)
下面的示例演示了如何在 Python 窗口中使用此工具。
import arcpy
from arcpy import env
arcpy.CheckOutExtension('3D')
env.workspace = 'C:/data'
arcpy.AppendTerrainPoints_3d('sample.gdb/featuredataset/terrain',
'existing_points', 'new_points.shp')
AppendTerrainPoints 示例 2(独立脚本)
下面的示例演示了如何在独立 Python 脚本中使用此工具。
'''****************************************************************************
Name: Update Terrain
Description: This script demonstrates how to update a terrain dataset
with new elevation measurements obtained from Lidar by
importing LAS files to multipoint features, then appending the
new points to another multipoint feature that participates in a
terrain. The terrain's pyramids are modified to optimize its
draw speed.
****************************************************************************'''
# Import system modules
import arcpy
from arcpy import env
import exceptions, sys, traceback
try:
arcpy.CheckOutExtension("3D")
# Set environment settings
env.workspace = "C:/data"
# Set Variables
inTerrain = "sample.gdb/featuredataset/terrain"
currentPts = "existing_points"
lasFiles = ['las/NE_Philly.las',
'las/NW_Philly.las']
newPts = 'in_memory/update_pts'
# Define spatial reference of LAS files using factory code
# for NAD_1983_StatePlane_Pennsylvania_South
lasSR = arcpy.SpatialReference()
lasSR.factoryCode = 2272
lasSR.create()
arcpy.AddMessage("Converting LAS files to multipoint features...")
arcpy.ddd.LASToMultipoint(lasFiles, newPts, 1.5, 2, 1,
'INTENSITY', lasSR)
arcpy.AddMessage("Appending LAS points to {0}..."\
.format(currentPts))
arcpy.AppendTerrainPoints_3d(inTerrain, currentPts, newPts)
arcpy.AddMessage("Changing terrain pyramid reference scales...")
arcpy.ddd.ChangeTerrainReferenceScale(inTerrain, 1000, 500)
arcpy.ddd.ChangeTerrainReferenceScale(inTerrain, 2500, 2000)
arcpy.AddMessage("Adding terrain pyramid level...")
arcpy.ddd.AddTerrainPyramidLevel(inTerrain, "", "4 4500")
arcpy.AddMessage("Changing pyramid resolution bounds for breaklines...")
arcpy.ChangeTerrainResolutionBounds_3d(inTerrain, "breaklines", 5, 4)
arcpy.AddMessage("Building terrain...")
arcpy.ddd.BuildTerrain(inTerrain)
arcpy.AddMessage("Completed updates.")
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)
finally:
arcpy.CheckInExtension("3D")