Hi Thomas, The spatial index is used to limit the number of return tuples. It is used after the where condition and usually with spatial predicates (ST_Intersects, ST_Contains, ST_Iswithin...).
Here an example : SELECT a.* FROM TRONCON_HYDRO a, dep_france_dom b WHERE ST_Contains(b.the_geom, a.the_geom) AND b."NOM_DEPT"='LOIRE-ATLANTIQUE'; Explanation : http://www.orbisgis.org/documentation/user-doc/3-0-documentation/sql/examples/st_contains/ The query plan is adapted to support spatial index if the column a.the_geom or b.the_geom is indexed. The index of largest table is queried to speed improvement of the query. In GDMS, the scala SQL engine of your software OrbisGIS*, the developer must implements a SpatialIndexedFunction. This interface is "casted" by the logic plan builder of our SQL engine to query the index. So hard-coded in SQL engine ;-(. Moreover, PostGIS, the spatial extension spatial for PostgreSQL<http://postgresql.org> overloads the && operator to use the intersects operator (the bounding boxes of geometries intersect). IE SELECT id, the_geom FROM thetable WHERE the_geom && 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))' ; @Nicolas It would be interesting to have a look at st_contains function in the POSTGIS code to give a a work trail to Thomas and Noel ? Best regards Erwan. * https://github.com/irstv/orbisgis/tree/master/gdms/src/main/scala/org/gdms/sql/engine/step -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
