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

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 _
public void NearestFeature (
    IGeometry pShape,
    ref int pClosestFeatureFID,
    ref double pDistance
HRESULT NearestFeature(
  IGeometry* pShape,
  System.Int32* pClosestFeatureFID,
  System.Double* pDistance

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.


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