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

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

    Parameters

    geometry1
    The base geometry.
    geometry2
    The comparison geometry.

    Return Value

    True if if geometry1 and geometry2 overlap.
    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 overlap if the dimension of each is equal to the dimension of their intersection, but the intersection itself is not equal to either one.

    GeometryEngine Overlaps

    Example
    Determine if geometries overlap
    MapPoint pt1 = MapPointBuilderEx.CreateMapPoint(1.5, 1.5);
    MapPoint pt2 = MapPointBuilderEx.CreateMapPoint(1.25, 1.75);
    MapPoint pt3 = MapPointBuilderEx.CreateMapPoint(3, 1.5);
    MapPoint pt4 = MapPointBuilderEx.CreateMapPoint(1.5, 2);
    
    //
    // point and point overlap
    //
    bool overlaps = GeometryEngine.Instance.Overlaps(pt1, pt2);        // overlaps = false
    overlaps = GeometryEngine.Instance.Overlaps(pt1, pt1);             // overlaps = false
                                                                       // Two geometries overlap if the region of their intersection is of the same dimension as the geometries involved and 
                                                                       // is not equivalent to either of the geometries.  
    
    List<MapPoint> pts = new List<MapPoint>();
    pts.Add(pt1);
    pts.Add(pt2);
    pts.Add(pt3);
    
    List<MapPoint> pts2 = new List<MapPoint>();
    pts2.Add(pt2);
    pts2.Add(pt3);
    pts2.Add(pt4);
    
    //
    // pt and line overlap
    //
    Polyline polyline = PolylineBuilderEx.CreatePolyline(pts);
    bool isSimple = GeometryEngine.Instance.IsSimpleAsFeature(polyline);         // isSimple = true
    overlaps = GeometryEngine.Instance.Overlaps(polyline, pt1);                  // overlaps = false
    
    //
    // line and line
    //
    Polyline polyline2 = PolylineBuilderEx.CreatePolyline(pts2);
    isSimple = GeometryEngine.Instance.IsSimpleAsFeature(polyline2);             // isSimple = true
    overlaps = GeometryEngine.Instance.Overlaps(polyline, polyline2);            // overlaps = true
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also