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

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

    Parameters

    geometry1
    The base geometry.
    geometry2
    The comparison geometry.

    Return Value

    True if geometry1 and geometry2 are disjoint.
    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 are disjoint if they don't have any points in common. Equivalent to not Intersects.

    GeometryEngine Disjoint

    Example
    Determine if two Geometries are disjoint
    //
    // pt on pt
    //
    
    MapPoint pt = MapPointBuilderEx.CreateMapPoint(1.0, 1.0);
    MapPoint pt2 = MapPointBuilderEx.CreateMapPoint(2.0, 2.5);
    
    bool disjoint = GeometryEngine.Instance.Disjoint(pt, pt2);       // result is true
    
    MultipointBuilderEx mpb = new MultipointBuilderEx();
    mpb.AddPoint(pt);
    mpb.AddPoint(pt2);
    Multipoint multiPoint = mpb.ToGeometry();
    
    disjoint = GeometryEngine.Instance.Disjoint(multiPoint, pt);     // result is false
    
    // 
    // pt and line
    // 
    
    List<MapPoint> list = new List<MapPoint>();
    list.Add(MapPointBuilderEx.CreateMapPoint(1.0, 1.0));
    list.Add(MapPointBuilderEx.CreateMapPoint(3.0, 3.0));
    list.Add(MapPointBuilderEx.CreateMapPoint(5.0, 1.0));
    
    Polyline line1 = PolylineBuilderEx.CreatePolyline(list);
    disjoint = GeometryEngine.Instance.Disjoint(line1, pt2);       // result is true
    
    disjoint = GeometryEngine.Instance.Disjoint(pt2, line1);       // result is true
    
    // end pt of line
    disjoint = GeometryEngine.Instance.Disjoint(line1, pt);        // result is false
    
    //
    // pt and polygon
    //
    List<MapPoint> polyPts = new List<MapPoint>();
    polyPts.Add(MapPointBuilderEx.CreateMapPoint(3.0, 2.0));
    polyPts.Add(MapPointBuilderEx.CreateMapPoint(3.0, 6.0));
    polyPts.Add(MapPointBuilderEx.CreateMapPoint(6.0, 6.0));
    polyPts.Add(MapPointBuilderEx.CreateMapPoint(6.0, 2.0));
    
    Polygon poly1 = PolygonBuilderEx.CreatePolygon(polyPts);
    disjoint = GeometryEngine.Instance.Disjoint(poly1, pt);          // result is true
    disjoint = GeometryEngine.Instance.Disjoint(pt, poly1);          // result is true
    
    // 
    // line and line
    //
    
    List<MapPoint> list2 = new List<MapPoint>();
    list2.Add(MapPointBuilderEx.CreateMapPoint(1.0, 3.0));
    list2.Add(MapPointBuilderEx.CreateMapPoint(3.0, 1.0));
    list2.Add(MapPointBuilderEx.CreateMapPoint(5.0, 3.0));
    
    Polyline line2 = PolylineBuilderEx.CreatePolyline(list2);
    disjoint = GeometryEngine.Instance.Disjoint(line1, line2);         // result is false
    
    //
    // line and polygon
    //
    disjoint = GeometryEngine.Instance.Disjoint(poly1, line1);         // result is false
    disjoint = GeometryEngine.Instance.Disjoint(line1, poly1);         // result is false
    
    //
    // polygon and polygon
    //
    Envelope env = EnvelopeBuilderEx.CreateEnvelope(MapPointBuilderEx.CreateMapPoint(1.0, 1.0), MapPointBuilderEx.CreateMapPoint(4, 4));
    Polygon poly2 = PolygonBuilderEx.CreatePolygon(env);
    
    disjoint = GeometryEngine.Instance.Disjoint(poly1, poly2);         // result is false
    
    
    // disjoint3D
    
    SpatialReference sr = SpatialReferences.WGS84;
    
    MapPoint pt3D_1 = MapPointBuilderEx.CreateMapPoint(1, 1, 1, sr);
    MapPoint pt3D_2 = MapPointBuilderEx.CreateMapPoint(2, 2, 2, sr);
    MapPoint pt3D_3 = MapPointBuilderEx.CreateMapPoint(1, 1, 2, sr);
    
    MultipointBuilderEx mpbEx = new MultipointBuilderEx();
    mpbEx.AddPoint(pt3D_1);
    mpbEx.AddPoint(pt3D_2);
    mpbEx.HasZ = true;
    
    multiPoint = mpbEx.ToGeometry();
    disjoint = GeometryEngine.Instance.Disjoint3D(multiPoint, pt3D_2);     // disjoint = false
    disjoint = GeometryEngine.Instance.Disjoint3D(multiPoint, pt3D_3);     // disjoint = true
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also