find_nearest_stations¶
find_nearest_stations
¶
find_nearest_stations(lat: float, lon: float, info: DataFrame, *, k: int = 1, max_radius_m: float | None = None) -> DataFrame
Return the k stations closest to (lat, lon), with a distance column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lat
|
float
|
Query point (degrees). |
required |
lon
|
float
|
Query point (degrees). |
required |
info
|
DataFrame
|
Stations with |
required |
k
|
int
|
Number of nearest stations to return. |
1
|
max_radius_m
|
float
|
If given, drop stations farther than this (so fewer than |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
See Also
GeoKDTree : The spatial index underneath.
stations_near : Radius instead of k-nearest.