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
| Parameter | Description |
|---|---|
geom | The geometry object to clip. |
box | The 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)
该文章对您有帮助吗?