ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Geometry Namespace / EnvelopeBuilderEx Class / Union(Envelope) Method
The envelope with which to union. Cannot be null.
Example

In This Topic
    Union(Envelope) Method
    In This Topic
    Unions the envelope with the EnvelopeBuilderEx.
    Syntax
    public void Union( 
       Envelope envelope
    )
    Public Sub Union( _
       ByVal envelope As Envelope _
    ) 

    Parameters

    envelope
    The envelope with which to union. Cannot be null.
    Exceptions
    ExceptionDescription
    The input envelope is null.
    Remarks
    Sets this instance equal to the union of the base envelope and the input envelope. The XMin and YMin of the resulting envelope builder is the minimum XMin and YMin respectively between the base and input envelopes, and the XMax and YMax is the maximum XMax and YMax respectively between the base and input Envelopes.

    Union

    Example
    Union two Envelopes
    // use the convenience builders
    Envelope env1 = EnvelopeBuilderEx.CreateEnvelope(0, 0, 1, 1, SpatialReferences.WGS84);
    Envelope env2 = EnvelopeBuilderEx.CreateEnvelope(0.5, 0.5, 1.5, 1.5, SpatialReferences.WGS84);
    
    Envelope env3 = env1.Union(env2);
    
    double area = env3.Area;
    double depth = env3.Depth;
    double height = env3.Height;
    double width = env3.Width;
    double len = env3.Length;
    
    MapPoint centerPt = env3.Center;
    Coordinate2D coord = env3.CenterCoordinate;
    
    bool isEmpty = env3.IsEmpty;
    int pointCount = env3.PointCount;
    
    // coordinates
    //env3.XMin, env3.XMax, env3.YMin, env3.YMax
    //env3.ZMin, env3.ZMax, env3.MMin, env3.MMax
    
    bool isEqual = env1.IsEqual(env2);    // false
    
    
    // or use the builderEx constructors = don't need to run on the MCT.
    EnvelopeBuilderEx builderEx = new EnvelopeBuilderEx(0, 0, 1, 1, SpatialReferences.WGS84);
    builderEx.Union(env2);      // builder is updated to the result
    
    depth = builderEx.Depth;
    height = builderEx.Height;
    width = builderEx.Width;
    
    centerPt = builderEx.Center;
    coord = builderEx.CenterCoordinate;
    
    isEmpty = builderEx.IsEmpty;
    
    env3 = builderEx.ToGeometry() as Envelope;
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also