Union 3D (3D Analyst)

License Level:BasicStandardAdvanced

Summary

Merges closed, overlapping multipatch features from an input feature class.

Illustration

Union 3D

Usage

Syntax

Union3D_3d (in_feature_class, {group_field}, out_feature_class, {out_table}, {disable_optimization}, {output_all})
ParameterExplanationData Type
in_feature_class

The closed multipatch features to be intersected and aggregated.

Feature Layer
group_field
(Optional)

The field used to identify the features that should be grouped together.

Field
out_feature_class

The output multipatch feature class that will store the aggregated features.

Feature Class
out_table
(Optional)

A many-to-one table representing the relationship between input features and their aggregated counterparts.

Table
disable_optimization
(Optional)

Specifies whether optimization will automatically take place or is disabled:

  • ENABLEDOptimization is performed on the input data. The tool will do some preprocessing to detect which features may overlap, grouping them together to improve performance and create unique outputs for each set of overlapping features. This is the default.
  • DISABLEDNo optimization is performed on the input data. Feature will be union according to their grouping field, or all features will be unioned into a single output feature.
Boolean
output_all
(Optional)

Determines if the output feature class contains all features or only the overlapping ones that were unioned.

  • DISABLEDOnly unioned features are written to the output.
  • ENABLEDAll input features are written to the output. This is the default.
Boolean

Code Sample

Union3D 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.Union3D_3d('multipatch.shp', 'union_output.shp', 'GROUP_FIELD', 
                'DISABLE', 'ENABLE', 'UnionTable.dbf')
Union3D example 2 (stand-alone script)

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

'''****************************************************************************
Name: Union3D Example
Description: This script demonstrates how to use the 
             Union3D tool.
****************************************************************************'''
# Import system modules
import arcpy
import exceptions, sys, traceback
from arcpy import env

try:
    arcpy.CheckOutExtension('3D')
    # Set environment settings
    env.workspace = 'C:/data'
    # Set Local Variables
    inMP = "multipatch.shp"
    # Ensure output multipatch has a unique name
    outMP = arcpy.CreateUniqueName("union_output.shp")
    outTbl = arcpy.CreateUniqueName("UnionTable.dbf")
    GroupField = "Type"
    optimize = "DISABLE"
    solids = "ENABLE"
    #Execute Union3D
    arcpy.ddd.Union3D(inMP, outMP, GroupField, optimize, solids, outTbl)
    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
3/7/2014