Name

ST_OrientedEnvelope — Returns a minimum-area rectangle containing a geometry.

Synopsis

geometry ST_OrientedEnvelope( geometry geom );

Description

Returns the minimum-area rotated rectangle enclosing a geometry. Note that more than one such rectangle may exist. May return a Point or LineString in the case of degenerate inputs.

Availability: 2.5.0.

Requires GEOS >= 3.6.0.

Examples

Code
SELECT ST_OrientedEnvelope('MULTIPOINT ((0 0),(-1 -1),(3 2))');
Output
POLYGON((3 2,-1 -1,-1.12 -0.84,2.88 2.16,3 2))
Figure
Geometry figure for visual-st-orientedenvelope-01

Oriented envelope of a Point and LineString.

Code
SELECT ST_OrientedEnvelope(ST_Collect('LINESTRING(55 75,125 150)',
                ST_Point(20, 80))
                ) As wktenv;
Output
POLYGON((20 80,125 150,138.0769230769241 130.38461538461573,33.07692307692291 60.384615384615195,20 80))
Figure
Geometry figure for visual-st-orientedenvelope-02