Rhoana / pyrtree

An R-Tree implementation
36 stars 19 forks source link

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

Open ziya61 opened 6 years ago

ziya61 commented 6 years ago

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]]

Microndgt commented 5 years ago

Try walk method in RTree?

for node in rtree.walk(lambda o: True):
    print(node)
BenHaimItay commented 5 years ago

Small fix:

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