Union 3D (3D Analyst)
Summary
Computes the geometric intersection of the patches of overlapping multipatches, then aggregates the multipatches together. How many features are created as output depends on the tool's settings.
Usage
-
Input feature class or layer must have multipatch geometry.
-
Only closed multipatches will be processed. All other multipatches will be skipped, and an error written to the geoprocessing log. Use the Is Closed geoprocessing tool to see if any features are not closed.
-
Union 3D can create very large and complex features in the output feature class. These features may cause display problems and/or have poor performance when displayed. Use caution when deciding how many features to aggregate together.
-
The output feature class will not have any of the attributes on the input feature class. An optional table can be created recording which features where unioned together to create a new feature.
Union 3D is a 3D set operator as part of the 3D Features toolset. See Working with 3D set operators for more information on what set operators are and how to use them.
Syntax
Parameter | Explanation | Data Type |
in_feature_class |
The closed multipatch features to be intersected and aggregated. | Features |
group_field (Optional) |
The field used to group input multipatch features together for aggregation. | Field |
out_feature_class |
The multipatch feature class into which the aggregated multipatch(es) will be placed. | Feature Class |
out_table (Optional) |
A many to one table representing the Input Features and the Output Features that they where aggregated in to. | Table |
disable_optimization (Optional) |
Disables the optimization that automatically determines which multipatch features overlap, and only unions those features with overlaps.
| Boolean |
output_all (Optional) |
This option forces the tool to write out all input features as output features. Features that have no overlaps are written to the output unmodified. Overlapping features are unioned together, and then written to the output.
| Boolean |
Code Sample
The following Python Window script demonstrates how to use the Union 3D function in immediate mode.
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')
The following Python script demonstrates how to use the Union 3D function in a stand-alone 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)