PythonRTree最近-它到底做什么?

PythonRTree最近-它到底做什么?,python,r-tree,Python,R Tree,我有以下设置-它是基于点的rtree构建: from collections import defaultdict from math import sqrt import rtree.index points = [(5, 4), (3, 1), (6, 3), (2, 8), (7, 8), (8, 1), (2, 3), (0, 4), (3, 7), (6, 4)] idx = rtree.index.Rtree() for i, p in enumerate(points):

我有以下设置-它是基于点的rtree构建:

from collections import defaultdict
from math import sqrt
import rtree.index

points = [(5, 4), (3, 1), (6, 3), (2, 8), (7, 8), (8, 1), (2, 3), (0, 4), (3, 7), (6, 4)]

idx = rtree.index.Rtree()

for i, p in enumerate(points):
    idx.insert(i, p+p, p)
现在,我试图找到距离某个点一定距离内的所有点:

max_distance=5
p = (6,4)
list(idx.nearest(p, 5, objects='raw'))
我收到

[(6, 4), (6, 3), (5, 4), (8, 1), (2, 3), (7, 8)]
问题是-为什么
(3,1)
不包括在列表中?距离约为4.24,所以应该包括在内,对吗

最近的方法“返回给定坐标的k个最近的对象”。也就是说,它将返回与其距离无关的最近的对象

对象的距离不是最近函数的参数,如中所述。第二个参数是所需的结果数。在本例中,它返回六个值,因为点(6,3)、(5,4)与点(6,4)的距离(1)相同


要获取一定距离内的对象,应使用。

为什么要在
p+p
处插入?