[GRASS-dev] v.what and spatial index

Radim Blazek radim.blazek at gmail.com
Fri Sep 8 05:16:21 EDT 2006


On 9/7/06, Moritz Lennert <mlennert at club.worldonline.be> wrote:
> Radim's tests here
> http://grass.itc.it/pipermail/grass-dev/2004-November/016036.html
>
> seem to indicate that when the spatial index is reused several times by
> the module, the overhead of building it on the fly is not so important.

Yes, I think that the best solution is to rewrite the library to store
spatial index in a file, i.e. never keep the whole structure in memory
and read the tree items directly from the file. That should be
relatively simple IMO.
That is also described in my vector TODO.
It means to add support to read/write Node structures from/to file instead of
memory. Currently the nodes are referenced by pointer to memory which
could be replaced by file offset. You need to add some functions like
   struct Node *RTreeReadNode(long offset)
and use it in other functions, for example:
    struct Node *node = RTreeReadNode ( n->branch[i].child );
    hitCount += RTreeSearch(node, R, shcb, cbarg);
    RTreeFreeNode(node);
instead of
    hitCount += RTreeSearch(n->branch[i].child, R, shcb, cbarg);
But it will be better to keep both options - file and memory
and use it according to vector size.

Most of the general problems and suggested solutions are described in the TODO.

Radim




More information about the grass-dev mailing list