Skip to main content
Join points to their nearest neighbors using Sedona KNN semantics. Supports inner joins, default suffixes, exclusive=False, an optional positive max_distance result filter, and a new distance_col. Ties follow spark.sedona.join.knn.includeTieBreakers; all GeoPandas equidistant rows are not guaranteed. See sedona.spark.geopandas.sjoin_nearest for the full restrictions.

Signature

Parameters

GeoDataFrame
required
Distributed point frame searched for the nearest neighbor of each row.
str
default:"'inner'"
Only inner joins are supported.
float
default:"None"
Positive finite distance in CRS units. Filters nearest results; it does not reduce the KNN search radius.
str
default:"'left'"
Suffix for overlapping column names from this frame. Only the default is supported.
str
default:"'right'"
Suffix for overlapping column names from right. Only the default is supported.
str
default:"None"
New output column for the distance. Must not replace an input column.
bool
default:"False"
Only False is supported; equal points can match at distance zero.

Returns

GeoDataFrame
Nearest matches, with no guaranteed row order.