名称

ST_ClipByBox2D — 计算几何图形落在矩形内的部分。

大纲

geometry ST_ClipByBox2D(geometry geom, box2d box);

描述

以快速且宽松但可能无效的方式通过 2D 框剪切几何体。 拓扑上无效的输入几何图形不会导致抛出异常。 不保证输出几何图形有效(特别是,可能会引入多边形的自相交)。

这个函数是由 GEOS 模块执行的。

可用性:2.2.0

示例

This example relies on the implicit cast from geometry to box2d for the second parameter.

Code
SELECT ST_ClipByBox2D(geom, ST_MakeEnvelope(0, 0, 10, 10)) FROM mytab;