(Re)加载R树与spatialindex库 [英] (Re)loading the R Tree with spatialindex library

查看:723
本文介绍了(Re)加载R树与spatialindex库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用spatialindex(http://libspatialindex.github.com/)库来批量加载R树:

I am bulkloading an R Tree with spatialindex (http://libspatialindex.github.com/) library:

string baseName = "streets";
size_t capacity = 10 * 1024 * 1024;
bool bWriteThrough = false;
indexIdentifier = 0;

IStorageManager *disk = StorageManager::createNewDiskStorageManager(baseName, 512);
fileInMem = StorageManager
   ::createNewRandomEvictionsBuffer(*disk, capacity, bWriteThrough);

// bulkLoads my tree
bulkLoadRTree();

cout << "tree info:" << endl;
cout << *tree << endl;

delete disk;

以下是关于构建的树的信息:

The following is output at the info about the built tree:

    Dimension: 2 
    Fill factor: 0.7 
    Index capacity: 100 
    Leaf capacity: 100 
    Tight MBRs: enabled 
    Near minimum overlap factor: 32 
    Reinsert factor: 0.3 
    Split distribution factor: 0.4 
    Utilization: 69% 
    Reads: 1 
    Writes: 35980 
    Hits: 0 
    Misses: 0 
    Tree height: 4 
    Number of data: 2482376 
    Number of nodes: 35979 
    Level 0 pages: 35463 
    Level 1 pages: 507 
    Level 2 pages: 8 
    Level 3 pages: 1 
    Splits: 0 
    Adjustments: 0 
    Query results: 0 

现在我正试图加载保存在磁盘中的内容:

now I am trying to load what I have saved in the disk:

IStorageManager *ldisk = StorageManager::loadDiskStorageManager(baseName);
SpatialIndex::StorageManager::IBuffer* fileLoadBuffer = StorageManager
    ::createNewRandomEvictionsBuffer(*ldisk, capacity, bWriteThrough);

id_type id = 1;
tree = RTree::loadRTree(*fileLoadBuffer, id);
cout << *tree << endl;

且树只有一个节点(树的输出是:)

and the tree has only one node (the output of the tree is:)

    Dimension: 2
    Fill factor: 0.7
    Index capacity: 100
    Leaf capacity: 100
    Tight MBRs: enabled
    Near minimum overlap factor: 32
    Reinsert factor: 0.3
    Split distribution factor: 0.4
    Utilization: 0%
    Reads: 0
    Writes: 0
    Hits: 0
    Misses: 0
    Tree height: 1
    Number of data: 0
    Number of nodes: 1
    Level 0 pages: 1
    Splits: 0
    Adjustments: 0
    Query results: 0

我做错了什么?为什么我不从磁盘加载整个树?

What do I do wrong? Why don't I load the whole tree from the disk?

推荐答案

您对光盘的更改?

此外,通常会在磁盘上实现树,并且在第一次访问时不会完全读取它。

Plus, usually one would implement the tree on-disk, and not read it completely on the first access. So at this point, it cannot report accurate statistics.

或者您的 bulkLoadRTree 不会使用 fileInMem

这篇关于(Re)加载R树与spatialindex库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆