TIN To Raster (3D Analyst)
Summary
Creates a raster by interpolating its cell values from the elevation of the input TIN at the specified sampling distance.
Illustration
Usage
-
Because interpolation of the input TIN surface occurs at regular intervals, some loss of information in the output raster should be expected. How well the raster represents the TIN is dependent on the resolution of the raster and the degree and interval of TIN surface variation. Generally, as the resolution is increased, the output raster more closely represents the TIN surface. Because the raster is a cell structure, it cannot maintain the hard and soft breakline edges that may be present in the TIN.
-
You can accept the TIN's XMIN, YMIN as the default origin and the XMAX, YMAX as the upper right corner of the extent to generate a raster covering the full extent of the TIN. Alternatively, you can specify the output raster's origin, extent, and resolution or cell spacing to create a raster covering only a portion of the TIN.
-
When exporting a large raster, consider specifying the Output Data Type as an integer to save on disk space if the accuracy requirements of your z-values are such that they can be represented by integer data.
-
The output raster may be file based or created as a raster dataset in a geodatabase. Supported file-based formats include Esri Grid, ERDAS IMAGINE, and TIFF. The format is determined based on the output name. If the output path references a geodatabase, a geodatabase raster will be created. If the output resides in a normal file folder and does not include a file extension, an Esri Grid will be produced. Use of the extensions .img and .tif will produce IMAGINE or TIFF files.
Syntax
Parameter | Explanation | Data Type |
in_tin |
The input TIN. | TIN Layer |
out_raster |
The location and name of the output raster. When storing a raster dataset in a geodatabase or in a folder such as an Esri Grid, no file extension should be added to the name of the raster dataset. A file extension can be provided to define the raster's format when storing it in a folder:
If the raster is stored as a TIFF file or in a geodatabase, its raster compression type and quality can be specified using geoprocessing environment settings. | Raster Dataset |
data_type (Optional) |
The data type of the output raster can be defined by the following keywords:
| String |
method (Optional) |
The interpolation method used to create the raster.
| String |
sample_distance sampling_method distance (Optional) |
The sampling method and distance used to define the cell size of the output raster.
| 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 |
Code Sample
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.TinRaster_3d("tin", "raster.img", "INT", "LINEAR", "OBSERVATIONS 250", 1)
The following sample demonstrates the use of this tool in a stand-alone Python script:
'''******************************************************************
Name: TinRaster Example
Description: This script demonstrates how to use the
TinRaster tool to create rasters 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 setting
env.workspace = "C:/data"
# Set Local Variables
dataType = "INT"
method = "NATURAL_NEIGHBORS"
sampling = "CELLSIZE 10"
zfactor = "1"
# Create list of TINs
TINList = arcpy.ListDatasets("*", "Tin")
# Verify the presence of TINs in the list
if TINList:
# Iterate through the list of TINs
for dataset in TINList:
# Define the name of the output file
outRaster = "{0}_natural.img".format(dataset)
# Execute TinRaster
arcpy.ddd.TinRaster(dataset, outRaster, dataType,
method, sampling, zfactor)
print "Finished."
else:
print "There are no TIN(s) in {0}.".format(env.workspace)
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)