堆栈剖面 (3D Analyst)

许可等级:BasicStandardAdvanced

摘要

创建表格和可选图表,用于说明一个或多个多面体、栅格、TIN 或 terrain 表面上的线要素的剖面。

插图

Stack Profile example

用法

语法

StackProfile_3d (in_line_features, profile_targets, out_table, {out_graph})
参数说明数据类型
in_line_features

将在表面输入上描绘剖面的线要素。

Feature Layer
profile_targets
[profile_targets,...]

一个或多个多面体要素与构成正被描绘轮廓的表面模型的栅格、terrain 或 TIN 数据集。

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

包含通过将输入线要素插入堆栈目标获得的值的输出表。

Table
out_graph
(可选)

能够使用保存图表工具保存到磁盘的可选输出图表的内存名称。

Graph

代码实例

堆栈剖面 (StackProfile) 示例 1(Python 窗口)

下面的示例演示了如何在 Python 窗口中使用此工具:

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) 示例 2(独立脚本)

下面的示例演示了如何在独立 Python 脚本中使用此工具:

'''**********************************************************************
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)

环境

相关主题

许可信息

ArcGIS for Desktop Basic:需要 3D Analyst
ArcGIS for Desktop Standard:需要 3D Analyst
ArcGIS for Desktop Advanced:需要 3D Analyst
9/15/2013