From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2021-07-28 09:38:09
W dniu 28.07.2021 o 10:19, Panagiotis SIMATIS via Geometry pisze:
> I am a research student, and I am using the RTree by geometry boost.
> I am looking for a way to count the number of RTree nodes visited by a
> For example, assume a short RTree consisting only of a root and leaf
> nodes. Given a query /q/, the RTree visits the root, and the /n/
> children nodes that intersect with /q/. Hence, the query should return
> Can someone suggest a way to do so?
> In addition, can we separately count the intermediate and leaf nodes
> visited? So, in the previous example instead of /n/ it would return: 1
> intermediate node and /n/ leaf nodes.
There are 4 (2*2) different kinds of queries. So spatial and
distance/knn query performed after calling query() member function and
iterative spatial and distance/knn query performed by incrementing an
iterator returned by qbegin() member function.
I'll show you a quick and dirty way how you could count the nodes during
the non-iterative query performed by query() function. To do that you
could create some global variables in your code, then include
Boost.Geometry and Rtree and increment these variables when a node is
size_t internal_nodes_count, leafs_count;
// create rtree
internal_nodes_count = 0;
leafs_count = 0;
For this to work with spatial query you have to modify your version of
Boost.Geometry and increment internal_nodes_count here:
and leafs_count here:
In case of knn query the places are:
Have in mind that the number of visited nodes might change in Boost 1.77
and 1.78 because I'm currently modifying the queries.
Geometry list run by mateusz at loskot.net