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


IIndexQuery2.NearestFeatures Method (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Carto)  

IIndexQuery2.NearestFeatures Method

Finds all nearest features in index to the input shape (i.e. equal distance).

[Visual Basic .NET]
Public Sub NearestFeatures ( _
    ByVal pShape As IGeometry, _
    ByRef pSAIds As Object, _
    ByRef pDistance As Double _
)
[C#]
public void NearestFeatures (
    IGeometry pShape,
    ref object pSAIds,
    ref double pDistance
);
[C++]
HRESULT NearestFeatures(
  IGeometry* pShape,
  Variant* pSAIds,
  System.Double* pDistance
);
[C++]

Parameters pShape [in]
pShape is a parameter of type IGeometry* pSAIds [out]
pSAIds is a parameter of type VARIANT* pDistance [out]
pDistance is a parameter of type double*

Product Availability

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

Description

Returns the nearest indexed features in a variant array and the distance to them based on the input shape.

It is similar to the NearestFeature (no final S) method except that if two or more features are found as the closest and so are exactly at the same distance from the source geometry, then all those are returned in the array.

Pass the returned array into IFeatureClass.GetFeatures to get the corresponding features.

See Also

IIndexQuery2 Interface