Stack Profile (3D Analyst)

License Level:BasicStandardAdvanced

Summary

Creates a table and optional graph denoting the profile of line features over one or more multipatch, raster, TIN, or terrain surfaces.

Illustration

Stack Profile example

Usage

Syntax

StackProfile_3d (in_line_features, profile_targets, out_table, {out_graph})
ParameterExplanationData Type
in_line_features

The line features that will be profiled over the surface inputs.

Feature Layer
profile_targets
[profile_targets,...]

The one or more multipatch features and raster, terrain, or TIN datasets that contribute to the surface model being profiled.

Feature Layer; Raster Layer; Terrain Layer; TIN Layer
out_table

The output table containing the values obtained from interpolating the input line features over the stack targets.

Table
out_graph
(Optional)

The in-memory name of the optional output graph that can be saved to disk with the Save Graph tool.

Graph

Code Sample

StackProfile 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.StackProfile_3d('profile_line.shp', 'dem.tif; buildings.shp', 
                     'profile_values.dbf', 'Surface Profile')
StackProfile example 2 (stand-alone script)

The following sample demonstrates the use of this tool in a stand-alone Python script:

'''**********************************************************************
Name: Save Profiles to Graph Files
Description: Creates profile graphs of multipatch and surface features, 
             which are then saved as graph files.
**********************************************************************'''
# Import system modules
import arcpy
import exceptions, sys, traceback

# Set Local Variables
profileLine = arcpy.GetParameterAsText(0)
profileTargets = arcpy.GetParameterAsText(1) # input las files
profileTable = arcpy.CreateUniqueName('profile_table', 'in_memory')
graphName = "Sample Graph"
outGraph = arcpy.GetParameterAsText(2) # output graph file

try:
    arcpy.CheckOutExtension('3D')
    # Execute StackProfile
    arcpy.ddd.StackProfile(profileLine, profileTargets, profileTable, graphName)
    # Execute SaveGraph
    arcpy.management.SaveGraph(graphName, outGraph)
    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

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Requires 3D Analyst
ArcGIS for Desktop Standard: Requires 3D Analyst
ArcGIS for Desktop Advanced: Requires 3D Analyst
11/8/2012