2

r ツリーの構築にlibspatialindex ( http://libspatialindex.github.io/ ) ライブラリを使用しています: r ツリーに (緯度、経度) を一括ロードする次のコードを使用しています。特定の場所の一括読み込み (id、緯度、経度) が必要です。次のコードは、一括読み込みを実行します。しかし、入力ファイルを受け入れない理由がわかりません。libspatial インデックスのドキュメントがないため、混乱しています。

int main(int argc, char** argv)
{
    try
    {
        if (argc != 5)
        {
            std::cerr << "Usage: " << argv[0] << " input_file tree_file capacity utilization." << std::endl;
            return -1;
        }

        std::string baseName = argv[2];
        double utilization = atof(argv[4]);

        IStorageManager* diskfile = StorageManager::createNewDiskStorageManager(baseName, 4096);
            // Create a new storage manager with the provided base name and a 4K page size.

        StorageManager::IBuffer* file = StorageManager::createNewRandomEvictionsBuffer(*diskfile, 10, false);
            // applies a main memory random buffer on top of the persistent storage manager
            // (LRU buffer, etc can be created the same way).

        MyDataStream stream(argv[1]);

        // Create and bulk load a new RTree with dimensionality 2, using "file" as
        // the StorageManager and the RSTAR splitting policy.
        id_type indexIdentifier;
        ISpatialIndex* tree = RTree::createAndBulkLoadNewRTree(
            RTree::BLM_STR, stream, *file, utilization, atoi(argv[3]), atoi(argv[3]), 2, SpatialIndex::RTree::RV_RSTAR, indexIdentifier);

        std::cerr << *tree;
        std::cerr << "Buffer hits: " << file->getHits() << std::endl;
        std::cerr << "Index ID: " << indexIdentifier << std::endl;

        bool ret = tree->isIndexValid();
        if (ret == false) std::cerr << "ERROR: Structure is invalid!" << std::endl;
        else std::cerr << "The stucture seems O.K." << std::endl;

        delete tree;
        delete file;
        delete diskfile;
            // delete the buffer first, then the storage manager
            // (otherwise the the buffer will fail trying to write the dirty entries).
    }
    catch (Tools::Exception& e)
    {
        std::cerr << "******ERROR******" << std::endl;
        std::string s = e.what();
        std::cerr << s << std::endl;
        return -1;
    }

    return 0;
}

入力には、次のファイルを使用しています。

1 12.2 12.2 14.4 14.4
2 10.1 10.1 15.2 15.2
3 12.2 12.2 14.5 14.5
4 10.0 10.0 15.1 15.6

しかし、次のエラーが発生します。

IllegalArgumentException: The data input should contain insertions only.

誰かが私がどこで間違っているのか教えてください!!

4

0 に答える 0