I have a point A and trying to find the nearest point to A in a list of points (B, C, D).
I could use knn with haversine
metrics and get the nearest point like this:
knn = NearestNeighbors(n_neighbors=1, metric='haversine')
knn.fit(df['lat', 'lon'])
dist, idx = knn.kneighbors([(35.9157825, -79.0826045)])
However, I'm not sure if this point df.loc[idx]
will always be the same point i'd get if I calculate distance using geodesic?
knn is very fast compared to having to calculate geodesic distance for all the points in my list. So I would love to use knn if the nearest point would always be the same.