ArcObjects Library Reference (Geometry)  

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 ( _
    ByVal other As IGeometry, _
    ByVal resultDimension As esriGeometryDimension _
) As IGeometry
[C#]
public IGeometry Intersect (
    IGeometry other,
    esriGeometryDimension resultDimension
);
[C++]
HRESULT Intersect(
  IGeometry* other,
  esriGeometryDimension resultDimension,
  IGeometry** intersection
);
[C++]

Parameters

other

  other is a parameter of type IGeometry

resultDimension

  resultDimension is a parameter of type esriGeometryDimension

intersection [out, retval]

  intersection is a parameter of type IGeometry

Product Availability

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

Description

The Intersection of two Geometries of the same Dimension is a Geometry containing only the regions of overlap between the original geometries.

Remarks

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.

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.

Intersection Example

[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 | ITopologicalOperator.Intersect Method | IConstructMultipoint.ConstructIntersection Method | IConstructMultipoint.ConstructIntersectionEx Method