创建 Terrain (3D Analyst)

摘要

创建新的 terrain 数据集。

用法

语法

CreateTerrain_3d (in_feature_dataset, out_terrain_name, average_point_spacing, {max_overview_size}, {config_keyword}, {pyramid_type}, {windowsize_method}, {secondary_thinning_method}, {secondary_thinning_threshold})
参数说明数据类型
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 金字塔的点细化方法。

  • WINDOWSIZE使用在窗口大小方法参数中指定的条件,通过在根据每个金字塔等级的给定窗口大小定义的区域中选择数据点来执行细化。
  • ZTOLERANCE通过指定相对于全分辨率数据点的每个金字塔等级的垂直精度来执行细化。
String
windowsize_method
(可选)

用于在由窗口大小定义的区域中选择点的条件。仅当在金字塔类型参数中指定 WINDOWSIZE 时,此参数才适用。

  • ZMIN具有最小高程值的点。
  • ZMAX具有最大高程值的点。
  • ZMEAN具有高程值(最接近所有值的平均值)的点。
  • ZMINMAX具有最小和最大高程值的点。
String
secondary_thinning_method
(可选)

当正在使用窗口大小金字塔时,指定其他的细化选项来减少在平坦区域上所用的点数。如果某个区域内点的高度在为二次细化阈值参数提供的值的范围内,则会将区域视为平坦区域。在较高的分辨率金字塔等级下它的效果更明显,因为较小的区域更可能比较大的区域平坦。

  • NONE将不执行任何二次细化。这是默认设置。
  • MILD最适合保留线性不连续的地形(如建筑面和森林边界)。建议对包括地面点和非地面点的激光雷达使用该方法。该方法将抽稀最少的点。
  • MODERATE在性能和精度之间实现较好的折衷。该方法不像轻度抽稀方法那样保留很多详细信息,但整体上消除更多点时这两种方法相差无几。
  • STRONG移除大多数点,但不大可能保留着重描绘的要素。该方法的用途限于坡度逐渐更改的表面。例如,高度抽稀有助于提高裸露地面激光雷达或深海探测学的效率。
String
secondary_thinning_threshold
(可选)

用于通过“窗口大小”过滤器激活二次细化的垂直阈值。该值应等于或大于数据的垂直精度。

Double

代码示例

CreateTerrain 示例 1(Python 窗口)

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)
CreateTerrain 示例 2(独立脚本)

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")

环境

相关主题

许可信息

ArcView: 需要 3D Analyst
ArcEditor: 需要 3D Analyst
ArcInfo: 需要 3D Analyst

7/10/2012