Name

ST_ClipByBox2D — Computes the portion of a geometry falling within a rectangle.

Synopsis

geometry ST_ClipByBox2D(geometry geom, box2d box);

Description

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

Performed by the GEOS module.

Availability: 2.2.0

Examples

-- Rely on implicit cast from geometry to box2d for the second parameter
SELECT ST_ClipByBox2D(geom, ST_MakeEnvelope(0,0,10,10)) FROM mytab;
      

See Also

ST_Intersection, ST_MakeBox2D, ST_MakeEnvelope