Summary
Exports triangle faces from a TIN dataset to polygon features and provides slope, aspect, and optional attributes of hillshade and tag values for each triangle.
Illustration
Usage
Slope and aspect calculations are based on the plane of the triangle. Slope cannot be calculated properly if the linear unit of the TIN's coordinate system uses angular measures, like decimal degrees.
XY and Z linear units should be in the same unit of measure in order for slope and hillshade calculations to provide accurate results. If the units differ but the TIN has its vertical and horizontal coordinate systems defined, an appropriate Z-factor is automatically determined. Otherwise, the Z Factor parameter can be used to explicitly define the conversion factor to be applied on the elevation values.
Aspect values are expressed in degrees and assume that North is 0°. The values increase clockwise and are recorded in the Aspect field. An aspect value of -1 is assigned for any flat triangle in the TIN.
Slope can be returned in degrees or percent, and the field name that the values are recorded in depends on the selection made in the Slope Units parameter:
- PERCENT—Slope values will be stored in a field named Slope_Pct.
- DEGREE—Slope values will be stored in a field named Slope_Deg.
Hillshade values reflect the localized relief that is produced from a light source that assumes the azimuth and vertical angle specified in the Hillshade parameter. 0° is assumed to be North for the azimuth, and the brightness value is expressed in between 0 to 255, where the lower the number, the darker the shade.
Tag Value Field parameter will only be active if the TIN has tag values that were explicitly defined.
Syntax
TinTriangle_3d (in_tin, out_feature_class, {units}, {z_factor}, {hillshade}, {tag_field})
Parameter | Explanation | Data Type |
in_tin | The TIN dataset to process. | TIN Layer |
out_feature_class | The feature class that will be produced by this tool. | Feature Class |
units (Optional) | The units of measure to be used in calculating slope.
| 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
Licensing Information
- ArcGIS for Desktop Basic: Requires 3D Analyst
- ArcGIS for Desktop Standard: Requires 3D Analyst
- ArcGIS for Desktop Advanced: Requires 3D Analyst