Summary
Converts a terrain dataset into a new point or multipoint feature class.
Illustration
Usage
- Points are extracted for the specified pyramid level resolution and area of interest.
- If an embedded feature class is specified, the output points will only come from the embedded features. Otherwise, the output points will be derived from all points contributing to the terrain surface.
If an embedded feature contains lidar attributes, such as RGB, classification, or return values, the attributes will be written to the output feature class. However, the way the attributes are written will depend on the geometry type that is specified:
- MULTIPOINT—Attributes will be stored in BLOB field.
- POINT—Attributes will be stored in numeric fields.
For more information on embedded features, read Embedded feature classes.
Syntax
TerrainToPoints(in_terrain, out_feature_class, {pyramid_level_resolution}, {source_embedded_feature_class}, {out_geometry_type})
Parameter | Explanation | Data Type |
in_terrain | The terrain dataset to process. | Terrain Layer |
out_feature_class | The feature class that will be produced by this tool. | Feature Class |
pyramid_level_resolution (Optional) | The z-tolerance or window-size resolution of the terrain pyramid level that will be used by this tool. The default is 0, or full resolution. | Double |
source_embedded_feature_class (Optional) | The name of the terrain dataset's embedded points to be exported. If an embedded feature is specified, only the points from the feature will be written to the output. Otherwise, all points from all data sources in the terrain will be exported. | String |
out_geometry_type (Optional) | The geometry of the output feature class.
| String |
Code sample
TerrainToPoints 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.TerrainToPoints_3d("sample.gdb/featuredataset/terrain", "terrain_points.shp", "6", "<NONE>", "POINT")
TerrainToPoints example 2 (stand-alone script)
The following sample demonstrates the use of this tool in a stand-alone Python script.
'''*****************************************************************
Name: TerrainToPoints Example
Description: This script demonstrates how to use the
TerrainToPoints tool.
*****************************************************************'''
# Import system modules
import arcpy
from arcpy import env
import exceptions, sys, traceback
try:
arcpy.CheckOutExtension("3D")
# Set environment settings
env.workspace = "C:/data"
# Set Local Variables
terrain = "sample.gdb/featuredataset/terrain"
outPts = arcpy.CreateUniqueName("terrain_pts", "sample.gdb")
outGeo = "POINT"
# Execute TerrainToPoints
arcpy.ddd.TerrainToPoints(terrain, outPts, 6, "<NONE>", outGeo)
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
- Basic: Requires 3D Analyst
- Standard: Requires 3D Analyst
- Advanced: Requires 3D Analyst