LandXML To TIN (3D Analyst)

Summary

This tool imports one or more triangulated irregular network (TIN) surfaces from a LandXML file to output ESRI TINs.

Usage

Syntax

LandXMLToTIN_3d (in_landxml_path, out_tin_folder, tin_basename, {tinnames})
ParameterExplanationData Type
in_landxml_path

The input LandXML file.

File
out_tin_folder

The folder that the TINs will be created in.

Folder
tin_basename

The name of the output TINs.

String
tinnames
(Optional)

Specifies the TINs to import for LandXML files that contain multiple TINs.

Each TIN can be specified by either a name (for example, "Tin01") or its position in the list of available LandXML TINs (for example 1 to specify the first TIN). The list of TINs to import can be entered as a semicolon-delimited string (for example, "1. Tin01; 2. Tin02"), a list of strings (for example, ["1. Tin01", "2. Tin02"]), or a list of numeric values that denote the position of the desired TINs (for example, [1, 2, 3]).

String

Code Sample

LandXMLToTIN example 1 (Python window)

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")
LandXMLToTIN example 2 (stand-alone script)

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)

Environments

Related Topics

Licensing Information

ArcView: Requires 3D Analyst
ArcEditor: Requires 3D Analyst
ArcInfo: Requires 3D Analyst

6/10/2013