TIN Triangle (3D Analyst)

License Level:BasicStandardAdvanced

Summary

Exports triangle faces from a triangulated irregular network (TIN) dataset to a polygon feature class and provides slope, aspect, and optional attributes of hillshade and tag value for each triangle.

Illustration

TIN Triangle illustration

Usage

Syntax

TinTriangle_3d (in_tin, out_feature_class, {units}, {z_factor}, {hillshade}, {tag_field})
ParameterExplanationData Type
in_tin

The input TIN.

TIN Layer
out_feature_class

The output feature class.

Feature Class
units
(Optional)

The units of measure to be used in calculating slope.

  • PERCENTSlope is expressed as a percentage value. This is the default.
  • DEGREESlope is expressed as the angle of inclination from a horizontal plane.
String
z_factor
(Optional)

The factor by which Z values will be multiplied. This is typically used to convert Z linear units to match XY linear units. The default is 1, which leaves elevation values unchanged.

Double
hillshade
HILLSHADE <azimuth>, <angle>
(Optional)

Specifies the azimuth and altitude angles of the light source when applying a hillshade effect for the feature layer output. Azimuth can range from 0 to 360 degrees, whereas altitude can range from 0 to 90. An azimuth of 45 degrees and altitude of 30 degrees would be entered as "HILLSHADE 45, 30".

String
tag_field
(Optional)

The field name in the output feature that will store the triangle tag value. This parameter is empty by default, which will result in tag values not being written to the output.

String

Code Sample

TinTriangle 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.TinTriangle_3d("tin", "tin_triangle.shp", "DEGREE", 1,"HILLSHADE 310,45", "tag")
TinTriangle example 2 (stand-alone script)

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

'''****************************************************************************
Name: TinTriangle Example
Description: This script demonstrates how to use the 
             TinTriangle tool to extract triangles from each TIN in the 
             target workspace.
****************************************************************************'''
# Import system modules
import arcpy
from arcpy import env
import exceptions, sys, traceback

try:
    arcpy.CheckOutExtension("3D")
    # Set environment settings
    env.workspace = "C:/data" # the target workspace
    # Create list of TINs
    TINList = arcpy.ListDatasets("*", "Tin")
    # Verify the presence of TINs in the list
    if TINList:
        for dataset in TINList:
            # Set Local Variables
            TINList = arcpy.ListDatasets("*", "Tin")
            slopeUnits = "PERCENT"
            zfactor = 1
            hillshade = "HILLSHADE 300, 45" # defines hillshade azimuth & angle
            tagField = "Tag"
            Output = dataset + "_triangles.shp" # name of the output file
            #Execute TinTriangle
            arcpy.ddd.TinTriangle(dataset, Output, slopeUnits, zfactor,
                                  hillshade, tagField)
            print "Finished."
    else:
        print "There are no TIN(s) in the " + env.workspace + " directory."
    arcpy.CheckInExtension("3D")
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

ArcGIS for Desktop Basic: Requires 3D Analyst
ArcGIS for Desktop Standard: Requires 3D Analyst
ArcGIS for Desktop Advanced: Requires 3D Analyst
3/7/2014