gpt4 book ai didi

c++ - boost : persistent storage of R-trees?

转载 作者:可可西里 更新时间:2023-11-01 18:35:42 26 4
gpt4 key购买 nike

因此 boost 以 R 树的形式提供了很好的空间索引功能。这很好,但似乎还不可能在构建树后对其进行序列化,我错了吗?

通常的“out_archive << rtree”语法不起作用,因为 rtree 没有 serialize() 成员。在 boost 1.57 中似乎有一些实验代码,例如/boost/geometry/index/detail/serialization.hpp,但它实际上似乎没有编译!

那么第一个问题:有人知道如何使用 boost 序列化 R 树吗?

如果没有,那么我的第二个问题:您将如何将索引永久存储在磁盘上以避免每次都重建它? (我有一个包含 145M 条目的数据集,构建索引需要几个小时,所以我真的不想构建它不止一次!)

最佳答案

  1. 打包算法和批量加载

    可以加载包(使用打包算法)。

    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

    更多详情:http://www.boost.org/doc/libs/1_57_0/libs/geometry/doc/html/geometry/spatial_indexes/introduction.html

  2. 使用内存映射文件

    您可以将内存映射文件与自定义分配器一起使用。这样你就可以使用你想要的任何表示,它会自动持久化

    更多详情: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

关于c++ - boost : persistent storage of R-trees?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27945299/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com