Pergunta

Where can I find the source codes of spatial relationships functions such as ST_Overlaps?

Foi útil?

Solução

PostGIS's git mirror is https://github.com/postgis/postgis . The master source is in svn. You would've learned this if you had done a Google search for "postgis source" and found the relevant page on the postgis site.

ST_Overlaps is declared in SQL as:

CREATE OR REPLACE FUNCTION ST_Overlaps(geom1 geometry, geom2 geometry)
    RETURNS boolean
    AS 'SELECT $1 && $2 AND _ST_Overlaps($1,$2)'

which in turn refers to:

CREATE OR REPLACE FUNCTION _ST_Overlaps(geom1 geometry, geom2 geometry)
        RETURNS boolean
        AS 'MODULE_PATHNAME','overlaps'
        LANGUAGE 'c' IMMUTABLE STRICT
        COST 100;

so the C implementation is a function named overlaps, which is defined in postgis/lwgeom_geos.c (found with ctags -R to build a source index, then vim -t overlaps, but you can use whatever C search tools you like, or just grep).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top