As far I can see now, there is two files related to gist indexing with 
ST_Intersects :

postgis.sql.in.c <http://svn.osgeo.org/postgis/trunk/postgis/postgis.sql.in>
:

-- Availability: 1.2.2
> -- Inlines index magic
> CREATE OR REPLACE FUNCTION ST_Intersects(geom1 geometry, geom2 geometry)
>     RETURNS boolean
>     AS 'SELECT $1 && $2 AND _ST_Intersects($1,$2)'
>     LANGUAGE 'sql' IMMUTABLE;
>
 
and operators overload :
legacy_gist.sql.in<http://svn.osgeo.org/postgis/trunk/postgis/legacy_gist.sql.in>

CREATE OPERATOR CLASS

After that, it is PostgreSql engine.



Le mardi 21 mai 2013 21:10:54 UTC+2, bocher a écrit :
>
> 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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to