This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > II > IIndexQuery2 Interface > IIndexQuery2.NearestFeature Method (ArcObjects .NET 10.5 SDK) |
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
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.