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 的 basename。要从 LandXML 文件中导出多个 TIN 时,basename 用于为各个输出 TIN 定义唯一名称。如果已存在 <basename>,该工具将不能写入任何内容。如果 <basename> 不存在,但 <basename>2 存在,则工具将创建 <basename><basename>2_1,而不会创建 <basename>2

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

一个或多个 LandXML TIN 表面将导出至一个 Esri TIN 中。可以按照名称或其在 LandXML 文件中的索引位置来指定各个 LandXML TIN,其中数字 1 表示第一个 TIN,2 表示第二个,以此类推。

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
5/10/2014