[SciPy-User] kdtree, custom distance function

Gustavo Goretkin gustavo.goretkin@gmail....
Mon Nov 14 23:37:25 CST 2011


The kdtree algorithm uses axis-aligned partitions on the space, so I
do not think it can work with a general distance metric.

I am not speaking from much experience, but you may want to consider
"GNAT" described here [1] and implemented in this library [2], which
contains python bindings for much of the library's functionality, but
apparently not the data structures.

Gustavo



[1] http://infolab.stanford.edu/~sergey/near.html
[2] http://ompl.kavrakilab.org/classompl_1_1NearestNeighborsGNAT.html

On Mon, Nov 14, 2011 at 12:05 PM, Oleksandr Huziy <guziy.sasha@gmail.com> wrote:
> Hello,
>
> I am trying to use scipy.spatial.kdtree to interpolate data from a lat/lon
> grid to a set of points (also with lat/lon coordinates).
>
> Is it possible to specify a custom distance function for the kdtree that
> should be used for querying?
>
> Also is there a function that computes distance on a sphere in
> scipy.spatial?
>
> thanks
>
> --
> Oleksandr Huziy
> UQAM
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>


More information about the SciPy-User mailing list