ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / Intersects Method
The base geometry.
The comparison geometry.
Example

In This Topic
    Intersects Method (GeometryEngine)
    In This Topic
    Returns true if geometry1 and geometry2 intersect.
    Syntax
    public bool Intersects( 
       Geometry geometry1,
       Geometry geometry2
    )
    Public Function Intersects( _
       ByVal geometry1 As Geometry, _
       ByVal geometry2 As Geometry _
    ) As Boolean

    Parameters

    geometry1
    The base geometry.
    geometry2
    The comparison geometry.

    Return Value

    True if the two geometries intersect.
    Exceptions
    ExceptionDescription
    Either geometry1 or geometry2 or both are null or empty.
    The method is not implemented for GeometryBag.
    Incompatible spatial references between the input geometries.
    Remarks
    Two geometries intersect if they have at least one point in common. Equivalent to not Disjoint.
    Example
    Intersection between two Polylines
    // determine intersection between two polylines
    
    List<MapPoint> pts = new List<MapPoint>();
    pts.Add(MapPointBuilderEx.CreateMapPoint(1.0, 1.0));
    pts.Add(MapPointBuilderEx.CreateMapPoint(3.0, 3.0));
    pts.Add(MapPointBuilderEx.CreateMapPoint(5.0, 1.0));
    
    Polyline line1 = PolylineBuilderEx.CreatePolyline(pts);
    
    List<MapPoint> pts2 = new List<MapPoint>();
    pts2.Add(MapPointBuilderEx.CreateMapPoint(1.0, 3.0));
    pts2.Add(MapPointBuilderEx.CreateMapPoint(3.0, 1.0));
    pts2.Add(MapPointBuilderEx.CreateMapPoint(5.0, 3.0));
    
    Polyline line2 = PolylineBuilderEx.CreatePolyline(pts2);
    
    bool intersects = GeometryEngine.Instance.Intersects(line1, line2);    // intersects = true
    Geometry g = GeometryEngine.Instance.Intersection(line1, line2, GeometryDimensionType.EsriGeometry0Dimension);
    Multipoint resultMultipoint = g as Multipoint;
    
    // result is a multiPoint that intersects at (2,2) and (4,2)
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also