TIN 三角形 (3D Analyst)

许可等级:BasicStandardAdvanced

摘要

将三角面从不规则三角网 (TIN) 数据集导出到面要素类,并为每个三角形提供山体阴影的坡度、坡向和可选属性以及标签值。

插图

TIN Triangle illustration

用法

语法

TinTriangle_3d (in_tin, out_feature_class, {units}, {z_factor}, {hillshade}, {tag_field})
参数说明数据类型
in_tin

输入 TIN。

TIN Layer
out_feature_class

输出要素类。

Feature Class
units
(可选)

在计算坡度中所用的测量单位。

  • PERCENT坡度以百分比值形式表示。这是默认设置。
  • DEGREE坡度以相对于水平面的倾角形式表示。
String
z_factor
(可选)

Z 值将乘上的系数。此值通常用于转换 Z 线性单位来匹配 XY 线性单位。默认值为 1,此时高程值保持不变。

Double
hillshade
HILLSHADE <azimuth>, <angle>
(可选)

为要素图层输出应用山体阴影效果时指定光源的方位角和高度角。方位角的范围为 0 至 360 度,高度角的范围为 0 至 90。方位角为 45 度,高度角为 30 度的输入形式为“HILLSHADE 45, 30”

String
tag_field
(可选)

将存储三角形标签值的输出要素中的字段名称。该参数默认为空,将导致标签值无法写入输出。

String

代码实例

TinTriangle 示例 1(Python 窗口)

下面的示例演示了如何在 Python 窗口中使用此工具:

import arcpy
from arcpy import env

arcpy.CheckOutExtension("3D")
env.workspace = "C:/data"
arcpy.TinTriangle_3d("tin", "tin_triangle.shp", "DEGREE", 1,"HILLSHADE 310,45", "tag")
TinTriangle 示例 2(独立脚本)

下面的示例演示了如何在独立 Python 脚本中使用此工具:

'''****************************************************************************
Name: TinTriangle Example
Description: This script demonstrates how to use the 
             TinTriangle tool to extract triangles from each TIN in the 
             target workspace.
****************************************************************************'''
# Import system modules
import arcpy
from arcpy import env
import exceptions, sys, traceback

try:
    arcpy.CheckOutExtension("3D")
    # Set environment settings
    env.workspace = "C:/data" # the target workspace
    # Create list of TINs
    TINList = arcpy.ListDatasets("*", "Tin")
    # Verify the presence of TINs in the list
    if TINList:
        for dataset in TINList:
            # Set Local Variables
            TINList = arcpy.ListDatasets("*", "Tin")
            slopeUnits = "PERCENT"
            zfactor = 1
            hillshade = "HILLSHADE 300, 45" # defines hillshade azimuth & angle
            tagField = "Tag"
            Output = dataset + "_triangles.shp" # name of the output file
            #Execute TinTriangle
            arcpy.ddd.TinTriangle(dataset, Output, slopeUnits, zfactor,
                                  hillshade, tagField)
            print "Finished."
    else:
        print "There are no TIN(s) in the " + env.workspace + " directory."
    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)

环境

相关主题

许可信息

ArcGIS for Desktop Basic: 需要 3D Analyst
ArcGIS for Desktop Standard: 需要 3D Analyst
ArcGIS for Desktop Advanced: 需要 3D Analyst
5/10/2014