Does anyone know how to traverse the whole tree in this Python Rtree library?
I've checked all its methods but failed to find a interface for this.
Any help would be appreciated.
Does anyone know how to traverse the whole tree in this Python Rtree library?
I've checked all its methods but failed to find a interface for this.
Any help would be appreciated.
Do an intersection()
query with the input parameters being those returned by bounds()
? By definition everything in the index will intersect with a space equal to the bounds of the index.
I just tried to accomplish this, started to create a new thread for this and stackoverflow suggested me this thread instead.
For anyone stumbling across the same, I got ya.
Here is my working code.
import rtree
from random import random
rands =[random() for i in range(100)]
def generator_function():
for i, coord in enumerate(rands):
yield(i, (coord, coord+1, coord, coord+1), coord)
rtree = rtree.index.Index(generator_function())
for point in rtree.intersection(rtree.bounds):
print(point)