ArcGIS Enterprise SDK

ITopologicalOperator.Intersect Method

Constructs the geometry that is the set-theoretic intersection of the input geometries. Use different resultDimension values to generate results of different dimensions.

[Visual Basic .NET]Public Function Intersect ( _ByValotherAsIGeometry, _ByValresultDimensionAsesriGeometryDimension _) AsIGeometry

[C#]publicIGeometryIntersect (IGeometryother,esriGeometryDimensionresultDimension);

When two geometries of the same dimension intersect with resultDimension the same as the input geometries, the output is a geometry containing only the regions of overlap between the original geometries.

Intersection is basically an AND between input geometries.

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.

Note that when esriGeometryNoDimension is specified as resultDimension, the output will be in the dimension of the minimum dimension of the input geometries.

This method does not support GeometryBags.

Since ArcGIS 9.2, Intersect has a larger cost - it takes longer to run the method. Therefore, it is a better approach to test if the two geometries are disjoint before calling Intersect.

[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