So boost provides nice spatial indexing capabilities in the form of R-trees. This is neat, however it doesn't seem possible yet to serialize the tree once it is built, am I wrong?
The usual "out_archive << rtree" syntax doesn't work because rtree doesn't have a serialize() member. In boost 1.57 there seems to be some experimental code for that, e.g. /boost/geometry/index/detail/serialization.hpp, but it actually doesn't seem to compile!
So first question : does someone know how to serialize an R-tree with boost?
If not, then my second question : how would you go about to permanently store your index on disk to avoid having to rebuild it every time? (I have a dataset of 145M entries and it takes several hours to build the index so I really don't want to have to build it more than once!)
It's possible to load packs (using the Packing algorithm).
Additionally there are also algorithms creating R-tree containing some, number of objects. This technique is called bulk loading and is done by use of packing algorithm [5] [6]. This method is faster and results in R-trees with better internal structure. This means that the query performance is increased.
[5] Leutenegger, Scott T.; Edgington, Jeffrey M.; Lopez, Mario A. (1997). STR: A Simple and Efficient Algorithm for R-Tree Packing
[6] Garcia, Yvan J.; Lopez, Mario A.; Leutenegger, Scott T. (1997). A Greedy Algorithm for Bulk Loading R-trees
More details: http://www.boost.org/doc/libs/1_57_0/libs/geometry/doc/html/geometry/spatial_indexes/introduction.html
You can use a memory mapped file with custom allocators. This way you can use any representation you wish and it will automatically persist
More details: http://www.boost.org/doc/libs/1_57_0/libs/geometry/doc/html/geometry/spatial_indexes/rtree_examples/index_stored_in_mapped_file_using_boost_interprocess.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With