ST_Intersects

更新时间:
复制 MD 格式

Tests if a grid and a geometry share at least one point in common.

Syntax

boolean ST_Intersects(geomgrid grid, geometry geom);
boolean ST_Intersects(geometry geom, geomgrid grid);

Parameters

ParameterDescription
gridThe grid whose spatial relationship you want to query.
geomThe geometry whose spatial relationship you want to query.

Description

ST_Intersects returns true if the grid and the geometry intersect (that is, their intersection is not empty), and false otherwise.

The geometry must use the CGC2000 (China Geodetic Coordinate System 2000) spatial reference system. The Spatial Reference System Identifier (SRID) of the geometry must be 4490.

Examples

The following example tests whether the grid G001331032213300013 intersects with a line string geometry.

SELECT ST_Intersects(
    ST_gridfromtext('G001331032213300013'),
    ST_geomfromtext('LINESTRING(122.48077 51.72814, 122.47416 51.73714)', 4490)
);

Output:

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

The result t indicates that the grid intersects with the geometry.