Terrain To Points (3D Analyst)

Summary

Converts a terrain dataset into a new point or multipoint feature class.

Illustration

Terrain to Points Example

Usage

Syntax

TerrainToPoints_3d (in_terrain, out_feature_class, {pyramid_level_resolution}, {source_embedded_feature_class}, {out_geometry_type})
ParameterExplanationData Type
in_terrain

The input terrain dataset.

Terrain Layer
out_feature_class

The output feature class.

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 type of the output feature class.

  • MULTIPOINTThe output point features will be written to a multipoint feature class. This is the default.
  • POINTThe output point features will be written to a point 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

Related Topics

Licensing Information

ArcView: Requires 3D Analyst
ArcEditor: Requires 3D Analyst
ArcInfo: Requires 3D Analyst

6/10/2013