Name

ST_Intersects — 如果两个几何图形相交(它们至少有一个共同点),则返回True。

Synopsis

boolean ST_Intersects( geometry geomA , geometry geomB );

boolean ST_Intersects( geography geogA , geography geogB );

描述

如果几何图形或地理图形共享任何部分的空间,则它们相交。对于地理位置--公差为0.00001米(因此任何接近的点都被认为是相交的)

ST_Overlaps、ST_Touches、ST_In都隐含着空间交集。如果上述任一项返回TRUE,则这些几何图形在空间上也相交。对于空间相交,不相交意味着FALSE。

[Note]

This function automatically includes a bounding box comparison that makes use of any spatial indexes that are available on the geometries.

更改:删除了3.0.0 SFCGAL版本,并添加了对2D TIN的本地支持。

增强:2.5.0支持GEOMETRYCOLLECTION。

增强:2.3.0对PIP短路的增强扩展到支持多点和少点。以前的版本仅支持多边形中的点。

由GEOS模块(用于几何)执行,地理是原生的

可用性:1.5引入了对地理位置的支持。

[Note]

对于地理,此函数的距离公差约为0.00001米,并使用球体而不是椭球体计算。

[Note]

注意:这是“允许的”版本,返回布尔值,而不是整数。

This method implements the OGC Simple Features Implementation Specification for SQL 1.1. S2.1.1.2//s2.1.13.3-ST_Intersects(G1,G2)-- > NOT(ST_DISCOCT(G1,G2))

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

This method supports Circular Strings and Curves

This function supports Triangles and Triangulated Irregular Network Surfaces (TIN).

几何图形示例

SELECT ST_Intersects('POINT(0 0)'::geometry, 'LINESTRING ( 2 0, 0 2 )'::geometry);
 st_intersects
---------------
 f
(1 row)
SELECT ST_Intersects('POINT(0 0)'::geometry, 'LINESTRING ( 0 0, 0 2 )'::geometry);
 st_intersects
---------------
 t
(1 row)

-- Look up in table. Make sure table has a GiST index on geometry column for faster lookup.
SELECT id, name FROM cities WHERE ST_Intersects(geom, 'SRID=4326;POLYGON((28 53,27.707 52.293,27 52,26.293 52.293,26 53,26.293 53.707,27 54,27.707 53.707,28 53))');
 id | name
----+-------
  2 | Minsk
(1 row)

地理例子

SELECT ST_Intersects(
    'SRID=4326;LINESTRING(-43.23456 72.4567,-43.23456 72.4568)'::geography,
    'SRID=4326;POINT(-43.23456 72.4567772)'::geography
    );

 st_intersects
---------------
t

另请参阅

& &, ST_3DIntersects, ST_Disjoint