TIN 转栅格 (3D Analyst)
插图
用法
-
由于以均匀的间隔对输入 TIN 表面进行插值,因此输出栅格中可能会出现信息的丢失。栅格是否能够准确地表示 TIN 将取决于栅格的分辨率及 TIN 表面的变化程度和间隔。通常,分辨率越高,输出栅格就越能准确地表示 TIN 表面。因为栅格是像元结构,所以它无法保持可能出现在输入 TIN 中的硬隔断线和软隔断线的边。
-
您可以接受 TIN 的 XMIN 和 YMIN 作为默认原点,接受 XMAX 和 YMAX 作为范围的右上角,以生成覆盖 TIN 完整范围的栅格数据。此外,您可以指定输出栅格的原点、范围和分辨率或像元间距以创建仅覆盖部分 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.
-
输出栅格可能是基于文件的,也可能作为地理数据库中的栅格数据集创建。支持的基于文件的格式包括 Esri Grid、ERDAS IMAGINE 和 TIFF。基于输出名称确定格式。如果输出路径引用地理数据库,则将创建地理数据库栅格。如果输出栅格位于普通文件夹中,不包含文件扩展名,则会生成 Esri Grid 格式的栅格。使用扩展名“.img”和“.tif”将生成 IMAGINE 或 TIFF 文件。
语法
参数 | 说明 | 数据类型 |
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 (可选) |
The data type of the output raster can be defined by the following keywords:
| String |
method (可选) |
用于创建栅格的插值方法。
| String |
sample_distance sampling_method distance (可选) |
The sampling method and distance used to define the cell size of the output raster.
| String |
z_factor (可选) |
The factor by which elevation values will be multiplied. This is typically used to convert Z linear units that match those of the XY linear units. The default is 1, which leaves elevation values unchanged. | Double |
代码示例
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)