ArcObjects Library Reference (Geometry)  

IRelationalOperator.Within Method

Indicates if this geometry is contained (is within) another geometry.

[Visual Basic .NET]
Public Function Within ( _
    ByVal other As IGeometry _
) As Boolean
[C#]
public bool Within (
    IGeometry other
);
[C++]
HRESULT Within(
  IGeometry* other,
  VARIANT_BOOL* Within
);
[C++]

Parameters

other

  other is a parameter of type IGeometry

Within [out, retval]   Within is a parameter of type VARIANT_BOOL

Product Availability

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

Description

The base geometry is within the comparison geometry if the base geometry is the intersection of the geometries and the intersection of their interiors is not empty.  Within is a Clementini operator. Within is the opposite operator of contains.

Remarks

Only geometries that support the IRelationalOperator interface can be used as input geometries.

If geometry1 is Within geometry2, then geometry2 Contains geometry1.

An empty geometry is within another geometry, unless the other geometry is empty.

Within examples. Only "true" relationships are showed in this picture.

See Also

IRelationalOperator Interface