[geos-devel] Indexing question from a newbie

Chris Hodgson chodgson at refractions.net
Fri Jul 7 13:34:17 EDT 2006


I belive the difference between the quadtree and SRTree implementations 
is that the quad tree is not editable once it is created and you start 
querying it, while you can continue to add and remove envelopes from an 
SRTree, intermixed between queries. Assuming that your data is static 
and you don't need to change the index on the fly, I believe that the 
quadtree will give you better performance.

There should be examples of how to use both of these indexes within the 
geos code itself. I believe the graph-building operations use an index 
to locate the nearby nodes/edges when inserting new ones? I could be 
wrong, but I'm sure if you search for references to index classes within 
the geos code itself, you will find a usage example.

I'll second Paul's suggestion that PostGIS will let you do this far more 
easily, assuming it fits your other requirements.

Hope that helps!

Chris Hodgson


> Sudipta Sarkar wrote:
> 
>> Hi All,
>> I am trying to use GEOS to create envelope geometries for a bunch of 
>> different tiles and create a spatial index based on these geometries. 
>> The purpose is to select features lying within a particular tile based 
>> on an initial query on the spatial index of these different tiles. I 
>> am a complete newbie to GEOS so was hoping if anyone can suggest as to 
>> which index amidst Quadtree and SRTree will work best for my purpose. 
>> It will also be helpful if anyone can point me to any example script 
>> in C/C++ that uses GEOS to build indexes and query them.
>>
>> Any help is appreciated.
>> Thanks




More information about the geos-devel mailing list