Union (Analysis)

Computes a geometric intersection of the Input Features. All features will be written to the Output Feature Class with the attributes from the Input Features, which it overlaps.

Learn more about how Union works


Illustration

Union illustration

Usage tips

Syntax

Union_analysis (in_features, out_feature_class, join_attributes, cluster_tolerance, gaps)
Parameter Explanation Datatype
Input Features (Required)

A list of the input feature classes or layers. When the distance between features is less than the cluster tolerance, the features with the lower rank will snap to the feature with the higher rank. The highest rank is one. All the Input Features must be polygons. With ArcView and Editor licenses, the number of input feature classes or layers is limited to two.

(Feature Layer Long; Feature Layer Long;...)
Output Feature Class (Required)

The feature class that will contain the results.

Feature Class
JoinAttributes (Optional)

Determines which attributes from the Input Features will be transferred to the Output Feature Class.

  • ALL—All the attributes from the Input Features will be transferred to the Output Feature Class. This is the default.
  • NO_FID—All the attributes except the FID from the Input Features will be transferred to the Output Feature Class.
  • ONLY_FID—Only the FID field from the Input Features will be transferred to the Output Feature Class.

String
XY Tolerance (Optional)

The minimum distance separating all feature coordinates (nodes and vertices) as well as the distance a coordinate can move in X or Y (or both). You can set the value to be higher for data that has less coordinate accuracy and lower for datasets with extremely high accuracy.

Linear unit
Gaps Allowed (Optional)

Gaps are areas in the output feature class that are completely enclosed by other polygons. This is not invalid, but it may be desirable to identify these for analysis. To find the gaps in the output, set this option to NO_GAPS, and a feature will be created in these areas. To select these features, query the output feature class based on all the input feature's FID values being equal to -1.

  • GAPS—No feature will be created for areas in the output that are completely enclosed by polygons. This is the default.
  • NO_GAPS—A feature will be created for the areas in the output that are completely enclosed by polygons. This feature will have blank attributes.

Boolean
Data types for geoprocessing tool parameters

Script Example

# Create the geoprocessor
import arcgisscripting
gp = arcgisscripting.create()

# Set the current workspace (to avoid having to specify the full path to the feature classes each time)
gp.Workspace = "c:/test_data"

try:
    # Union 3 feature classes but only carry the FID attributes to the output
    gp.union_analysis("well_buff50; stream_buff200; waterbody_buff500", "water_buffers", "ONLY_FID", 0.0003)

    # Union 3 other feature classes, but specify some ranks for each since parcels has better spatial accuracy
    gp.union_analysis("counties 2; parcels 1; state 2", "state_landinfo")

except:
    # If an error occurred when running Union, print out the error message.
    print gp.GetMessages(2)

See Also

  • Intersect (Analysis)
  • Symmetrical Difference (Analysis)
  • Union (Coverage)
  • Comparison of overlay tools
  • An overview of the overlay toolset