This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > ArcMapUI > ESRI.ArcGIS.ArcMapUI > Interfaces > IS > ISpatialJoin Interface > ISpatialJoin.JoinNearest Method (ArcObjects .NET 10.4 SDK) |
Joins with the nearest feature in the join feature class. Only features within a distance of maxMapDist will be joined. A maxMapDist of -1 means infinity.
[Visual Basic .NET] Public Function JoinNearest ( _ ByVal pOutputName As IName, _ ByVal maxMapDist As Double _ ) As IFeatureClass
[C#] public IFeatureClass JoinNearest ( IName pOutputName, double maxMapDist );
JoinNearest identifies the nearest feature in the join table to features in the source table. The maxMapDist parameter determines the search radius for the join operation. Negative maxMapDist values other than -1 (infinity) are invalid and will produce an empty output feature class.
For example, joining a source layer containing line features (rivers) to a layer which contains point features (cities) with LeftOuterJoin = FALSE. Where a match is successful, the new output layer will contain a record for each feature in the source table with the corresponding attribute columns for the nearest feature in the join table.
Rivers and cities feature classes:
New output feature class table:
ISpatialJoin Interface | IFeatureClass Interface | Feature Class