创建 Terrain (3D Analyst)
摘要
创建新的 terrain 数据集。
用法
terrain 必须位于要素数据集中。
-
平均点间距参数应基于将在 terrain 中使用的数据。虽然该值不需要精确,但应具有较好的近似程度。如果在不同位置上收集数据的密度差异极大,则应该在决定此值时更多地考虑较小的间距。
使用点空间来确定 terrain 分块大小,其用来优化数据分析和显示性能。每个分块大约包含不超过 200,000 个源高程点。
使用添加 Terrain 金字塔等级和向 Terrain 添加要素类,然后使用构建 Terrain 来完成 terrain 定义并构造可用的 terrain。
-
用于构造 terrain 的地理处理工具专为 Python 脚本和“模型构建器”中的数据自动化程序所设计。若要交互式创建新 terrain,考虑使用 ArcCatalog 中的 Terrain 向导或目录 窗口。要访问 Terrain 向导,右键单击要素数据集,然后单击新建 > Terrain。
语法
参数 | 说明 | 数据类型 |
in_feature_dataset |
将创建 terrain 数据集的要素数据集。 | Feature Dataset |
out_terrain_name |
输出 terrain 数据集。 | String |
average_point_spacing |
构建 terrain 时所用数据点之间的平均或近似水平距离。对于摄影测量、雷达和声纳测量采集的数据,其间距通常为已知量。应该使用该值。如果不确定间距为多少,应返回查看数据,而不是主观猜测。间距以要素数据集坐标系的水平单位加以指定。 | Double |
max_overview_size (可选) |
terrain 概貌是 terrain 数据集的最粗略表示,类似于缩略图概念。最大大小表示为创建概貌而进行采样的测量点的数量上限。 | Long |
config_keyword (可选) |
ArcSDE 的配置关键字。配置关键字用来优化数据库存储,通常由数据库管理员配置该关键字。 | String |
pyramid_type (可选) |
用来构造 terrain 金字塔的点细化方法。
| String |
windowsize_method (可选) |
用于在由窗口大小定义的区域中选择点的条件。仅当在金字塔类型参数中指定 WINDOWSIZE 时,此参数才适用。
| String |
secondary_thinning_method (可选) |
当正在使用窗口大小金字塔时,指定其他的细化选项来减少在平坦区域上所用的点数。如果某个区域内点的高度在为二次细化阈值参数提供的值的范围内,则会将区域视为平坦区域。在较高的分辨率金字塔等级下它的效果更明显,因为较小的区域更可能比较大的区域平坦。
| String |
secondary_thinning_threshold (可选) |
用于通过“窗口大小”过滤器激活二次细化的垂直阈值。该值应等于或大于数据的垂直精度。 | 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.CreateTerrain_3d('source.gdb/Redlands', 'Redlands_terrain', 5, 50000, '', 'WINDOWSIZE', 'ZMIN', 'NONE', 1)
The following sample demonstrates the use of this tool in a stand-alone Python script:
"""**************************************************************************** Name: Create Terrain from TIN Description: This script demonstrates how to create a terrain dataset using features extracted from a TIN. It is particularly useful in situations where the source data used in the TIN is not available, and the amount of data stored in the TIN proves to be too large for the TIN. The terrain's scalability will allow improved display performance and faster analysis. The script is designed to work as a script tool with 5 input arguments. ****************************************************************************""" # Import system modules import arcpy import exceptions, sys, traceback from arcpy import env # Set local variables tin = arcpy.GetParameterAsText(0) # TIN used to create terrain gdbLocation = arcpy.GetParameterAsText(1) # Folder that will store terran GDB gdbName = arcpy.GetParameterAsText(2) # Name of terrain GDB fdName = arcpy.GetParameterAsText(3) # Name of feature dataset terrainName = arcpy.GetParameterAsText(4) # Name of terrain try: arcpy.CheckOutExtension("3D") # Create the file gdb that will store the feature dataset arcpy.management.CreateFileGDB(gdbLocation, gdbName) gdb = '{0}/{1}'.format(gdbLocation, gdbName) # Obtain spatial reference from TIN SR = arcpy.Describe(tin).spatialReference # Create the feature dataset that will store the terrain arcpy.management.CreateFeatureDataset(gdb, fdName, SR) fd = '{0}/{1}'.format(gdb, fdName) # Export TIN elements to feature classes for terrain arcpy.AddMessage("Exporting TIN footprint to define terrain boundary...") boundary = "{0}/boundary".format(fd) # Execute TinDomain arcpy.ddd.TinDomain(tin, tinDomain, 'POLYGON') arcpy.AddMessage("Exporting TIN breaklines...") breaklines = "{0}/breaklines".format(fd) # Execute TinLine arcpy.ddd.TinLine(tin, breaklines, "Code") arcpy.AddMessage("Exporting TIN nodes...") masspoints = "{0}/masspoints".format(fd) # Execute TinNode arcpy.ddd.TinNode(sourceTIN, TIN_nodes) arcpy.AddMessage("Creating terrain dataset...") terrain = "terrain_from_tin" # Execute CreateTerrain arcpy.ddd.CreateTerrain(fd, terrainName, 10, 50000, "", "WINDOWSIZE", "ZMEAN", "NONE", 1) arcpy.AddMessage("Adding terrain pyramid levels...") terrain = "{0}/{1}".format(fd, terrainName) pyramids = ["20 5000", "25 10000", "35 25000", "50 50000"] # Execute AddTerrainPyramidLevel arcpy.ddd.AddTerrainPyramidLevel(terrain, "", pyramids) arcpy.AddMessage("Adding features to terrain...") inFeatures = "{0} Shape softclip 1 0 10 true false boundary_embed <None> "\ "false; {1} Shape masspoints 1 0 50 true false points_embed "\ "<None> false; {2} Shape softline 1 0 25 false false lines_embed "\ "<None> false".format(boundary, masspoints, breaklines) # Execute AddFeatureClassToTerrain arcpy.ddd.AddFeatureClassToTerrain(terrain, inFeatures) arcpy.AddMessage("Building terrain...") # Execute BuildTerrain arcpy.ddd.BuildTerrain(terrain, "NO_UPDATE_EXTENT") arcpy.GetMessages() 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")