This document is archived and information here might be outdated.  Recommended version.


ITopologicalOperator.ConstructUnion Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IT > ITopologicalOperator Interface > ITopologicalOperator.ConstructUnion Method
ArcGIS Developer Help

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

The attributes of the first geometry are transferred to the unioned geometry. For example, if the first geometry in the enumeration is z-aware, then the result geometry will also be z-aware. 

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.

Temporary 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