arcpy.3d.CreateTerrain(in_feature_dataset, out_terrain_name, average_point_spacing, {max_overview_size}, {config_keyword}, {pyramid_type}, {windowsize_method}, {secondary_thinning_method}, {secondary_thinning_threshold}, {triangulation_method})
|
名称
|
说明
|
数据类型
|
|
in_feature_dataset
|
将包含 terrain 数据集的要素数据集。
|
Feature Dataset
|
|
out_terrain_name
|
Terrain 数据集的名称。
|
String
|
|
average_point_spacing
|
对 terrain 建模时所用数据点之间的平均水平距离。 对于摄影测量、激光雷达和声纳测量等基于传感器的测量,通常已知所需使用的间距。 间距使用要素数据集坐标系的水平单位。
|
Double
|
|
max_overview_size
(可选)
|
Terrain 概貌类似于缩略图概念。 它是 terrain 数据集的最粗略表示,其最大大小表示为创建概貌而进行采样的测量点的数量上限。
|
Long
|
|
config_keyword
(可选)
|
用于优化企业级数据库中 terrain 存储的配置关键字。
|
String
|
|
pyramid_type
(可选)
|
指定将用于构建地形金字塔的点细化方法。
WINDOWSIZE—Data points in the area defined by a given window size for each pyramid level will be selected using the windowsize_method parameter value. This is the default.
ZTOLERANCE—The vertical accuracy of each pyramid level relative to the full resolution of the data points will be specified.
|
String
|
|
windowsize_method
(可选)
|
指定如何在由窗口大小定义的区域中选择点。 仅当在 pyramid_type 参数中指定 WINDOWSIZE 时,此参数才适用。
ZMIN—The point with the smallest elevation value will be selected. This is the default.
ZMAX—The point with the largest elevation value will be selected.
ZMEAN—The point with the elevation value closest to the average of all values will be selected.
ZMINMAX—The points with the smallest and largest elevation values will be selected.
|
String
|
|
secondary_thinning_method
(可选)
|
当使用窗口大小金字塔时,指定要执行的外加细化来减少在平坦区域上所用的点数。 如果某个区域内点的高度均在 secondary_thinning_threshold 参数值内,则可将该区域视为平坦区域。 在较高的分辨率金字塔等级下它的效果更明显,因为较小的区域更可能比较大的区域平坦。
NONE—No secondary thinning will be performed. This is the default.
MILD—Mild thinning will be performed to preserve linear discontinuities (for example, building sides and forest boundaries). This method is recommended for lidar that includes both ground and nonground points. It will thin the fewest points.
MODERATE—Moderate thinning will be performed, which provides a balance between performance and accuracy. This method does not preserve as much detail as mild thinning but comes close while eliminating more points overall.
STRONG—Strong thinning will be performed, which removes the most points but is less likely to preserve sharply delineated features. Limit its use to surfaces where slope tends to change gradually. For example, strong thinning is efficient for bare-earth lidar and bathymetry.
|
String
|
|
secondary_thinning_threshold
(可选)
|
将 pyramid_type 参数设置为 WINDOWSIZE 后,用于激活二次细化的垂直阈值。 将该值设置为等于或大于数据的垂直精度。
|
Double
|
|
triangulation_method
(可选)
|
指定是否要通过增密隔断线要素的线段使其符合用于构建 TIN 表面的 Delaunay 三角测量规则,从而将其合并到 terrain 表面中。
Delaunay 三角测量将增密隔断线要素以容纳其周围的点,从而避免创建细长三角形。在分析基于 TIN 的表面时,这些三角形通常会产生不良结果。 此外,只能对符合 Delaunay 准则的三角测量执行自然邻域插值和泰森多边形生成。
受约束的 Delaunay 三角测量将避免增密隔断线要素,而是将隔断线段作为边合并到 TIN 表面中。 当您需要明确定义以确保不会被三角仪修改(即,分割为多条边)的某些边时,请考虑使用此选项。
|
String
|
派生输出
|
名称
|
说明
|
数据类型
|
|
derived_out_terrain
|
新 terrain 数据集。
|
Terrain
|
代码示例
CreateTerrain 示例 1(Python 窗口)
下面的示例演示了如何在 Python 窗口中使用此工具:
arcpy.env.workspace = 'C:/data'
arcpy.ddd.CreateTerrain('source.gdb/Redlands', 'Redlands_terrain', 5,
50000, '', 'WINDOWSIZE', 'ZMIN', 'NONE', 1)
下面的示例演示了如何在独立 Python 脚本中使用此工具:
"""****************************************************************************
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
# 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:
# 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)
# Run TinDomain
arcpy.ddd.TinDomain(tin, tinDomain, 'POLYGON')
arcpy.AddMessage("Exporting TIN breaklines...")
breaklines = "{0}/breaklines".format(fd)
# Run TinLine
arcpy.ddd.TinLine(tin, breaklines, "Code")
arcpy.AddMessage("Exporting TIN nodes...")
masspoints = "{0}/masspoints".format(fd)
# Run TinNode
arcpy.ddd.TinNode(sourceTIN, TIN_nodes)
arcpy.AddMessage("Creating terrain dataset...")
terrain = "terrain_from_tin"
# Run 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"]
# Run 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)
# Run AddFeatureClassToTerrain
arcpy.ddd.AddFeatureClassToTerrain(terrain, inFeatures)
arcpy.AddMessage("Building terrain...")
# Run BuildTerrain
arcpy.ddd.BuildTerrain(terrain, "NO_UPDATE_EXTENT")
arcpy.GetMessages()
except arcpy.ExecuteError:
print(arcpy.GetMessages())
except Exception as err:
print(err)