ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / Within Method
The base geometry.
The comparison geometry.

In This Topic
    Within Method (GeometryEngine)
    In This Topic
    Returns true if geometry1 is within geometry2.
    Syntax
    Public Function Within( _
       ByVal geometry1 As Geometry, _
       ByVal geometry2 As Geometry _
    ) As Boolean

    Parameters

    geometry1
    The base geometry.
    geometry2
    The comparison geometry.

    Return Value

    True if geometry1 is within geometry2.
    Exceptions
    ExceptionDescription
    Either geometry1 or geometry2 or both are null.
    The method is not implemented for GeometryBag.
    Incompatible spatial references between the input geometries.
    Remarks
    If both geometry1 and geometry2 are not empty, then geometry1 is within geometry2 if the intersection of their interiors is not empty and geometry1 is a subset of geometry2.

    If the geometry2 is empty, then geometry1 is not within geometry2.

    If geometry1 is empty and geometry2 is not empty, then geometry1 is within geometry2.

    Within is the opposite of Contains. That is, geometry1 is within geometry2 if and only if geometry2 contains geometry1.

    GeometryEngine Within

    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also