[geos-devel] use of STRtree functions in C API

Howard Butler hobu.inc at gmail.com
Tue May 4 10:00:49 EDT 2010


I would suggest at least investigating libspatialindex, which is an R* tree (and linear and quadratic splitting as well) implementation that is much more featureful than the unexposed internal indexing of GEOS.  I have just added a C API (GDAL or GEOS-style, it's a total rip-off of them) to libspatialindex, to allow users to do the basics like insertion and querying quite easily.  Additionally, with libspatialindex, you have the option of storing your index on disk and bulk loading (pre-sorting for much faster insert performance) the index.



PS, if you are in the Python world, you can use the Shapely (GEOS wrapper) and Rtree (libspatialindex wrapper) combination to do all kinds of magic quite painlessly.

On May 4, 2010, at 8:30 AM, Roger Bivand wrote:

> Hi,
> I'm investigating the use of STRtree functions in C API to find candidate GEOS_MULTIPOLYGON or GEOS_POLYGON objects to test for contiguity, with GEOSDisjoint() or GEOSTouches(). I think that I can see how to build the tree with envelopes of the polygon objects, using an int ID number as the inserted item. However, I'm very unsure how:
> extern void GEOS_DLL GEOSSTRtree_query_r(GEOSContextHandle_t handle,
>                                         GEOSSTRtree *tree,
>                                         const GEOSGeometry *g,
>                                         GEOSQueryCallback callback,
>                                         void *userdata);
> should be understood. The first three arguments appear clear, but neither of the remaining two is. userdata out could be a structure with a pre-allocated int array long enough to hold any intersected object IDs, with an int saying how many are present. Does anyone have any use examples of GEOSSTRtree_query in the C API?
> Grateful for any pointers,
> Roger
> -- 
> Roger Bivand
> Economic Geography Section, Department of Economics, Norwegian School of
> Economics and Business Administration, Helleveien 30, N-5045 Bergen,
> Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
> e-mail: Roger.Bivand at nhh.no
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel

More information about the geos-devel mailing list