Skip to content

traverse the entire Rtree to get the index size #970

Answered by awulkiew
JunoWang asked this question in Q&A
Discussion options

You must be logged in to vote

I don't know what would you like to do exactly and what do you mean by "sizes". But here is the general answer:

The number of elements is returned by rtree.size()

The bounding box enclosing all of the elements is returned by rtree.bounds()

You can iterate through all of the elements stored in the rtree using rtree.begin() and rtree.end() or just using the rtree in range for loop.

The numbers of internal nodes, leafs and other statistics can be gathered using this utility:
https://github.com/boostorg/geometry/blob/develop/include/boost/geometry/index/detail/rtree/utilities/statistics.hpp#L91

If you need something else you have to write your own visitor using the view used by the utilities …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@JunoWang
Comment options

Answer selected by JunoWang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants