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


IIndexQuery.NearestFeature Method (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Carto)  

IIndexQuery.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,
  long* pClosestFeatureFID,
  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

IIndexQuery Interface