ST_ClipByBox2D

更新时间:
复制 MD 格式

Clips a geometry by a 2D box in a fast but possibly invalid way. Topologically invalid input geometries do not raise exceptions. The output geometry is not guaranteed to be valid — in particular, self-intersections may be introduced for polygon geometries.

Syntax

geometry ST_ClipByBox2D(geometry geom, box2d box);

Parameters

ParameterDescription
geomThe geometry object to clip.
boxThe 2D box used for clipping.

Example

SELECT ST_AsText(ST_ClipByBox2D('LINESTRING(0 1,2 1)'::geometry, ST_MakeEnvelope(0,0,1,2)));
      st_astext
---------------------
 LINESTRING(0 1,1 1)
(1 row)
1