ST_Intersects

更新时间:
复制 MD 格式

Returns true if a grid and a geometry share at least one point in common, false otherwise.

Syntax

-- Grid-first
boolean ST_Intersects(geomgrid grid, geometry geom);

-- Geometry-first
boolean ST_Intersects(geometry geom, geomgrid grid);

Parameters

ParameterDescription
gridThe geomgrid value to test.
geomThe geometry value to test.

Usage notes

  • The geometry must use the CGC2000 spatial reference system. The Spatial Reference System Identifier (SRID) must be 4490.

Examples

The following example tests whether a specific grid cell intersects a line segment. The result t confirms that the grid and the line share at least one point.

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

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