storpipfugl / pykdtree

Fast kd-tree implementation in Python
GNU Lesser General Public License v3.0
209 stars 47 forks source link

Why sometimes it returns the same neighbor multiple times #44

Open zyxue opened 5 years ago

zyxue commented 5 years ago

image

As seen in the first row, 460448, 441197, 83629, 208359 are returned twice, what could be the reason, please?

zyxue commented 5 years ago

This problem becomes much more serious when k=100

djhoese commented 5 years ago

Just curious and just a guess, but are your input lng/lat points unique? I wonder if some of them are repeated and that's confusing the kdtree.

zyxue commented 5 years ago

yes, they're unique. I switched to scipy.spatial.KDTree, and not seeing the same problem.

mraspaud commented 5 years ago

@storpipfugl any idea ?

storpipfugl commented 5 years ago

pykdtree has been validated against scipy.spatial.KDTree so disagreement of results is unexpected. @zyxue : Is it possible for you to provide a minimal data set that reproduces the problem?