LandXML vers TIN (3D Analyst)

Niveau de licence :De baseStandardAvancé

Récapitulatif

Cet outil permet d'importer une ou plusieurs surfaces TIN (Triangulated Irregular Network, réseau triangulé irrégulier) d'un fichier LandXML vers les TIN Esri en sortie.

Utilisation

Syntaxe

LandXMLToTin_3d (in_landxml_path, out_tin_folder, tin_basename, {tinnames})
ParamètreExplicationType de données
in_landxml_path

Fichier LandXML en entrée.

File
out_tin_folder

Dossier dans lequel les TIN seront créés.

Folder
tin_basename

Nom de préfixe joint au TIN en sortie. Lorsque plusieurs TIN sont exportés à partir du fichier LandXML, le nom de base est suivi d'une valeur d'entier représentant l'ordre des TIN en sortie.

String
tinnames
[tinnames,...]
(Facultatif)

Chaque TIN peut être spécifié par un nom (par exemple, "Tin01") ou par sa position dans la liste de TIN LandXML disponibles (par exemple 1 pour spécifier le premier TIN). La liste de TIN à importer peut être entrée comme une chaîne dont les valeurs sont séparées par des points-virgules (par exemple, "1. Tin01; 2. Tin02"), une liste de chaînes (par exemple, ["1. Tin01", "2. Tin02"]), ou une liste de valeurs numériques qui représentent la position des TIN souhaités (par exemple, [1, 2, 3]).

String

Exemple de code

1er exemple d'utilisation du constructeur LandXMLToTin (fenêtre Python)

L'exemple suivant illustre l'utilisation de cet outil dans la fenêtre Python :

import arcpy
from arcpy import env

arcpy.CheckOutExtension("3D")
env.workspace = "C:/data"
arcpy.LandXMLToTin_3d("surfaces.xml", "TINs", "_", "1;2")
2e exemple d'utilisation du constructeur LandXMLToTin (script autonome)

L'exemple suivant illustre l'utilisation de cet outil dans un script Python autonome :

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

Environnements

Thèmes connexes

Informations de licence

ArcGIS for Desktop Basic : Requis 3D Analyst
ArcGIS for Desktop Standard : Requis 3D Analyst
ArcGIS for Desktop Advanced : Requis 3D Analyst
9/12/2013