Rhoana/pyrtree

How can I return all children and their bounds for non leaf and leaf nodes

Opened this issue · 2 comments

I want to return all children and their bounds for a rtree object. How can I do that I want to return all data structucture as following example;

mbr=Rectangle [x1=10.0, y1=4.0, x2=62.0, y2=85.0] #root
mbr=Rectangle [x1=28.0, y1=4.0, x2=34.0, y2=85.0] #children
entry=Entry [value=2, geometry=Point [x=29.0, y=4.0]] #leaf
entry=Entry [value=1, geometry=Point [x=28.0, y=19.0]]
entry=Entry [value=4, geometry=Point [x=34.0, y=85.0]]
mbr=Rectangle [x1=10.0, y1=45.0, x2=62.0, y2=63.0] #children
entry=Entry [value=5, geometry=Point [x=62.0, y=45.0]]
entry=Entry [value=3, geometry=Point [x=10.0, y=63.0]]

Try walk method in RTree?

for node in rtree.walk(lambda o: True):
    print(node)

Small fix:

for node in rtree.walk(lambda *o: True):
    print(node)