Name

ST_Touches — 如果两个几何图形至少有一个共同点,但其内部不相交,则返回True。

Synopsis

boolean ST_Touches(geometry A, geometry B);

描述

退货 TRUE 如果A和B相交,但它们的内部不相交。等价地,A和B至少有一个共同点,并且公共点位于至少一个边界内。对于点/点输入,关系始终为 FALSE ,因为点没有边界。

用数学术语来说,这种关系是:

如果两个几何图形的DE-9IM交集矩阵与以下其中之一匹配,则此关系成立:

  • FT*

  • F**T*

  • F*T*

[Note]

This function automatically includes a bounding box comparison that makes use of any spatial indexes that are available on the geometries. 若要避免使用索引,请使用 _ST_Touches 取而代之的是。

[Important]

增强:已启用3.0.0支持 GEOMETRYCOLLECTION

This method implements the OGC Simple Features Implementation Specification for SQL 1.1. S2.1.1.2//s2.1.13.3

This method implements the SQL/MM specification. SQL-MM 3:5.1.28

示例

这个 ST_Touches 谓词返回 TRUE 在下面的示例中。

POLYGON / POLYGON

POLYGON / POLYGON

POLYGON / LINESTRING

LINESTRING / LINESTRING

LINESTRING / LINESTRING

POLYGON / POINT

SELECT ST_Touches('LINESTRING(0 0, 1 1, 0 2)'::geometry, 'POINT(1 1)'::geometry);
 st_touches
------------
 f
(1 row)

SELECT ST_Touches('LINESTRING(0 0, 1 1, 0 2)'::geometry, 'POINT(0 2)'::geometry);
 st_touches
------------
 t
(1 row)