文档

ST_Relate

更新时间:

判断两个Geometry对象是否符合某种空间关系。例如:相交、包含等等。

语法

boolean ST_Relate(geometry geomA , geometry geomB , text intersectionMatrixPattern);
text ST_Relate(geometry geomA , geometry geomB);
text ST_Relate(geometry geomA , geometry geomB , integer boundaryNodeRule);

参数

参数名称

描述

geomA

第一个Geometry对象。

geomB

第二个Geometry对象。

intersectionMatrixPattern

DE-9IM关系。

boundaryNodeRule

边界节点法则。

描述

  • 第一个函数通过检测两个Geometry对象在内部、边界和外部的关系,确定两者是否在空间上与定义的DE-9IM矩阵模型相一致,若一致则返回True。

    • 这对于单一步骤测试交叉路口,十字路口等的复合检查特别有用。

    • 该函数不支持GeometryCollection类型对象作为输入参数。

  • 第二个函数返回两个Geometry对象的DE-9IM结果。该函数不支持GeometryCollection类型对象作为输入参数。

  • 第三个函数类似于第二个函数,但允许指定边界节点法则:

    • 1:OGC/MOD2

    • 2:Endpoint

    • 3:MultivalentEndpoint

    • 4:MonovalentEndpoint

示例

  • 模式一:

    SELECT ST_Relate('LINESTRING(0 0,0 1)'::geometry, 'LINESTRING(0 0,1 1)'::geometry,'FF1F00102');
     st_relate
    -----------
     t
    (1 row)
                        
  • 模式二:

    SELECT ST_Relate('LINESTRING(0 0,0 1)'::geometry, 'LINESTRING(0 0,1 1)'::geometry);
     st_relate
    -----------
     FF1F00102
    (1 row)
                        
  • 本页导读 (1)
文档反馈