knn function

Spatial K nearest neighbor