LandXML 转 TIN (3D Analyst)

许可等级:BasicStandardAdvanced

摘要

此工具将一个或多个不规则三角网 (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 的前缀名称。要从 LandXML 文件导出多个 TIN 时,基本名称后面将接一个反映 TIN 输出顺序的整数值。

String
tinnames
[tinnames,...]
(可选)

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

String

代码实例

LandXMLToTin 示例 1(Python 窗口)

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

import arcpy
from arcpy import env

arcpy.CheckOutExtension("3D")
env.workspace = "C:/data"
arcpy.LandXMLToTin_3d("surfaces.xml", "TINs", "_", "1;2")
LandXMLToTin 示例 2(独立脚本)

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

'''****************************************************************************
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)

环境

相关主题

许可信息

ArcGIS for Desktop Basic:需要 3D Analyst
ArcGIS for Desktop Standard:需要 3D Analyst
ArcGIS for Desktop Advanced:需要 3D Analyst
9/15/2013