在哪里可以找到空间关系函数的源代码,例如ST_Overlaps?
答案 0 :(得分:3)
PostGIS的git镜像是https://github.com/postgis/postgis。主源是svn。如果您在Google搜索“postgis源代码”并找到了the relevant page on the postgis site,那么您就可以了解到这一点。
ST_Overlaps
是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)'
反过来指的是:
CREATE OR REPLACE FUNCTION _ST_Overlaps(geom1 geometry, geom2 geometry)
RETURNS boolean
AS 'MODULE_PATHNAME','overlaps'
LANGUAGE 'c' IMMUTABLE STRICT
COST 100;
所以C实现是一个名为overlaps
的函数,它是defined in postgis/lwgeom_geos.c
(与ctags -R
一起构建源索引,然后vim -t overlaps
,但你可以使用任何你喜欢的C搜索工具,或者只是grep)。