判斷兩個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)