3D 差异 (3D Analyst)

许可等级:BasicStandardAdvanced

摘要

消除目标要素类中与减要素类中多面体要素的封闭体相重叠的多面体要素部分。

插图

Difference 3D

用法

语法

Difference3D_3d (in_features_minuend, in_features_subtrahend, out_feature_class, {out_table})
参数说明数据类型
in_features_minuend

通过剪除要素移除其自身要素的多面体要素。

Feature Layer
in_features_subtrahend

将从输入中减去的多面体要素。

Feature Layer
out_feature_class

包含所生成要素的输出多面体要素类。

Feature Class
out_table
(可选)

可选表,存储有关输入要素和差异输出之间关系的信息。此表中会显示下列字段:

  • Output_ID - 输出要素类的唯一 ID。
  • Minuend_ID - 主多面体的唯一 ID。
  • Subtrahend - 已从主多面体中减去的多面体要素的唯一 ID。
Table

代码实例

Difference3D 示例 1(Python 窗口)

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

import arcpy
from arcpy import env

arcpy.CheckOutExtension('3D')
env.workspace = 'C:/data'
arcpy.Difference3D_3d('input_mp.shp', 'erase_mp.shp', 'difference_mp.shp')
Difference3D 示例 2(独立脚本)

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

'''****************************************************************************
Name: Difference3D Example
Description: This script demonstrates how to create 
             shadow volumes that fall along a specified surface using the
             Difference3D tool.
****************************************************************************'''
# Import system modules
import arcpy
import exceptions, sys, traceback
from arcpy import env

try:
    # Obtain a license for the ArcGIS 3D Analyst extension
    arcpy.CheckOutExtension('3D')
    # Set environment settings
    env.workspace = 'C:/data'
    # Set Local Variables
    inMP = 'buildings.shp'
    eraseMP = 'bldg_extensions.shp'
    outMP = arcpy.CreateUniqueName('bldgs_without_extensions.shp')
    # Execute Difference3D
    arcpy.Difference3D_3d(inMP, eraseMP, outMP)

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
5/10/2014