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


IIndexQuery2.NearestFeature Method (ArcObjects .NET 10.7 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > II > IIndexQuery2 Interface > IIndexQuery2.NearestFeature Method
ArcGIS Developer Help

IIndexQuery2.NearestFeature Method

Finds the nearest feature in index to the input shape.

[Visual Basic .NET]
Public Sub NearestFeature ( _
    ByVal pShape As IGeometry, _
    ByRef pClosestFeatureFID As Integer, _
    ByRef pDistance As Double _
)
[C#]
public void NearestFeature (
    IGeometry pShape,
    ref int pClosestFeatureFID,
    ref double pDistance
);
[C++]
HRESULT NearestFeature(
  IGeometry* pShape,
  System.Int32* pClosestFeatureFID,
  System.Double* pDistance
);
[C++]
Parameters
pShape [in]

pShape is a parameter of type IGeometry* pClosestFeatureFID [out]
pClosestFeatureFID is a parameter of type long* 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 feature and the distance to it based on the input shape. 

Pass the returned long into IFeatureClass.GetFeature to get the corresponding feature.

See Also

IIndexQuery2 Interface