ArcObjects Library Reference (Geometry)  

ITopologicalOperator.ConstructUnion Method

Defines this geometry to be the union of the inputs. More efficient for unioning multiple geometries than calling Union repeatedly.

[Visual Basic .NET]
Public Sub ConstructUnion ( _
    ByVal geometries As IEnumGeometry _
)
[C#]
public void ConstructUnion (
    IEnumGeometry geometries
);
[C++]
HRESULT ConstructUnion(
  IEnumGeometry* geometries
);
[C++]

Parameters

geometries

  geometries is a parameter of type IEnumGeometry

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

ConstructUnion simultaneously Unions an Enumeration of geometries of the same Dimension into a single geometry.  ConstructUnion is more efficient for unioning a large collection of geometries simultaneously rather than cycling through each geometry individually.

Remarks

ITopologicalOperator methods must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, Bézier Curve), paths or rings, they must be wrapped into high-level geometries types.

This method does not support GeometryBags.

Temproray files might be created.  If environment variable "ARCTMPDIR" exists, then the files are written to the path, otherwise written to current directory or system temp directory.

[C#]

//The following code shows to wrap a line segment into a polyline in C#

//Assume a line (line1 as ILine) is already created

object obj = Type.Missing;

ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;

segCollection.AddSegment((ISegment)line1, ref obj, ref obj);

//Set the spatial reference on the new polyline

//The spatial reference is not transfered automatically from the segments

IGeometry geom = segCollection as IGeometry;

geom.SpatialReference = spatialRef;

//Can now be used with ITopologicalOperator methods

 

See Also

ITopologicalOperator Interface

.NET Samples

ViperPin tool (Code Files: ViperPinForm)

.NET Related Topics

How to create a union of several polygons