ST_INTERSECTS
如果两个 GEOMETRY 对象共享任意一部分空间,则返回 TRUE。
语法
ST_INTERSECTS(<geometry1>, <geometry2>)
参数
返回类型
布尔值。
示例
SELECT ST_INTERSECTS(
TO_GEOMETRY('LINESTRING(0 0, 2 2)'),
TO_GEOMETRY('LINESTRING(0 2, 2 0)')
) AS intersects;
╭────────────╮
│ intersects │
├────────────┤
│ true │
╰────────────╯
SELECT ST_INTERSECTS(
TO_GEOMETRY('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
TO_GEOMETRY('POINT(3 3)')
) AS intersects;
╭────────────╮
│ intersects │
├────────────┤
│ false │
╰────────────╯