Toblerity/rtree

Easy way to get number of entries in index

adamjstewart opened this issue · 1 comments

I would like to be able to easily query the number of entries in an index. I would expect len(index) to work. However, the __len__ attribute isn't defined. I recently discovered index.get_size(), which gives me exactly what I want, although it isn't documented. Could we rename get_size to __len__, or have __len__ call get_size? Alternatively, could we document get_size?

I'm happy to open a PR to do this, but it'll have to wait until next week.

hobu commented

Please make a PR providing this.

One issue IIRC with get_size on a full index is it might be a count estimate, not an actual count of the index entries inserted into the tree.