Boost :: Geometry R * Tree and paging / lazy loading?

I tried a SqLite3 RTree virtual table yesterday to get one or more Data Ids from Queries by Coordinates (WGS). It works really fast! Unfortunately rtree insertion / creation was slow (half an hour for Turkey).

Found that the Boost :: Geometry library also has an RTree implementation. My question regarding this RTree is: Can I use paging or lazy loading with this r * tree? We have large maps and only want to load the id into the rtree when asked for the appropriate coordinates. It is like a database that is loaded on pages (pages) only when the user requests it.

Thank you so much!

Henry

+3


source to share


1 answer


ROTRE's implementation of Boost.Geometry supports stateful generators. For example. you can use it with Boost.Interprocess to store rtree in shared memory or mapped file .

If you were able to implement an allocator by saving / loading nodes to / from files and allowing data access when the pointer returned by that allocator is dereferenced, it will work.

However, it might not be so easy if the distribution block loaded chunks of data if needed. Loading and accessing data is simple, but the allocator (or manager) will be forced to know when the data is no longer needed and there is currently no way to get this information directly. One could get it indirectly, but rtree has not been tested in that case, so the official answer to your question is that it is not supported.

I was planning to add support for persistent storage, but due to time constraints, I didn't. If you have ideas, want to help, etc. I invite you to the mailing list .



EDIT:

In fact, this can be done if the state allocator user has been explicitly notified by the user to perform the operation, for example. after an insert has been made, or for a number of finished inserts or queries. The allocator could still store some usage metric (like a sort count, for example) and do some caching, but it would know that some nodes could be removed if needed. I think it will be similar to ios flush (). However, this will not work out of the box in the case of packaging / bulk loading that processes items from top to bottom. So:

persistent_allocator alloc(/*...*/);
bgi::rtree</*...*/> rt(/*...*/, alloc);
// ...
rt.insert(/*...*/);
rt.insert(/*...*/);
rt.insert(/*...*/);
alloc.flush();

      

+4


source







All Articles