This document is archived and information here might be outdated.  Recommended version.


IRelationalOperator.Within Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IR > IRelationalOperator Interface > IRelationalOperator.Within Method
ArcGIS Developer Help

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
);
[C++]
Parameters
other 

other is a parameter of type IGeometry*

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