[GRASS-dev] v.what and spatial index

Glynn Clements glynn at gclements.plus.com
Wed Sep 6 14:28:17 EDT 2006


Moritz Lennert wrote:

> v.what calls Vect_build_spatial_index()
> 
> This function checks whether the spatial index is already available in 
> memory (checking whether Map->plus.Spidx_built is set) and if not, goes 
> on to call Vect_build_sidx_from_topo() which builds the actual index.
> 
> IIUC, the memory holding the index is released automatically when v.what 
> calls exit().
> 
> This means that for every v.what call the index needs to be rebuilt.
> 
> The discussion so far has been about putting the spatial index into a 
> file and then either erasing that file when the GRASS session is closed, 
> or even keeping it across sessions.
> 
> But, would it be possible to keep it in memory after v.what exits (or 
> whatever program is first to build the index in a session) and erase it 
> at the end of the GRASS session ? Or this is impossible with GRASS' 
> modular structure ?

Keeping it in memory isn't a practical solution; all of the standard
shared memory mechanisms are relatively complex to use and not
particularly portable. If a file is used often enough, and the system
has enough unused memory, the OS will cache the file in memory.

The main point about storing the spatial index is that the
functionality needs to be integrated into the vector libraries and/or
core modules, so that the index is either updated or deleted if the
map is changed. Any mechanism which requires the user to manually
synchronise the index with the map isn't acceptable, IMHO.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list