LandXML 转 TIN (3D Analyst)

摘要

此工具将一个或多个不规则三角网 (TIN) 表面从 LandXML 文件导入到输出 ESRI TIN。

用法

语法

LandXMLToTIN_3d (in_landxml_path, out_tin_folder, tin_basename, {tinnames})
参数说明数据类型
in_landxml_path

输入 LandXML 文件。

File
out_tin_folder

将要在其中创建 TIN 的文件夹。

Folder
tin_basename

输出 TIN 的名称。

String
tinnames
(可选)

针对包含多个 TIN 的 LandXML 文件,指定所要导入的 TIN。

每个 TIN 可通过一个名称(例如,“Tin01”)或其在可用 LandXML TIN 列表中的位置(例如,1 指定第一个 TIN)指定。要导入的 TIN 列表可输入为以分号分隔的字符串(例如,"1. Tin01; 2. Tin02”),一系列字符串(例如,["1. Tin01", "2. Tin02"]),或一系列表示所需 TIN 位置的数值(例如, [1, 2, 3]).

String

代码示例

LandXML 转 TIN (LandXMLToTIN) 示例 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.LandXMLToTin_3d("surfaces.xml", "TINs", "_", "1;2")
LandXML 转 TIN (LandXMLToTIN) 示例 2(独立脚本)

The following sample demonstrates the use of this tool in a stand-alone Python script:

'''****************************************************************************
Name: LandXMLToTin Example
Description: This script demonstrates how to use the 
             ListFiles method to collect all LandXML (*.xml) files in a 
             workspace as input for the Import3DFiles tool.
****************************************************************************'''
# Import system modules
import arcpy
from arcpy import env
import exceptions, sys, traceback

try:
    # Obtain a license for the ArcGIS 3D Analyst extension
    arcpy.CheckOutExtension("3D")
    # Set environment settings
    env.workspace = "C:/data"
    # Use ListFiles method to grab all xml files (assumedly LandXML files)
    landList = arcpy.ListFiles("*.xml")
    if landList:
        for landFile in landList:
            # Set Local Variables
            outputFolder = "TINs" # The folder that the TINs will be created in
            outputBase = "Madagascar_" # Base name will be applied to all output TINs
            grab = "1" # TIN selection can be chosen by enumerated values (e.g. 1;2)
            # Execute Import3DFiles
            arcpy.LandXMLToTin_3d(landFile, outputFolder, outputBase, grab)
            print "Completed creating TIN(s) from {0}.".format(landFile)
    else:
        "There are no xml files in {0}.".format(env.workspace)

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)

环境

相关主题

许可信息

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

7/10/2012