ST_Envelope — Returns a geometry representing the bounding box of a geometry.
geometry ST_Envelope(geometry g1);
Returns the double-precision (float8) minimum bounding box for the supplied geometry, as a geometry. The polygon is defined by the corner points of the bounding box ((MINX, MINY), (MINX, MAXY), (MAXX, MAXY), (MAXX, MINY), (MINX, MINY)). (PostGIS will add a ZMIN/ZMAX coordinate as well).
I casi degeneri (linee verticali, punti) restituiranno una geometria di dimensione inferiore al POLYGON, cioè POINT o LINESTRING.
Disponibilità: il comportamento nella 1.5.0 è stato cambiato per dare in uscita numeri in precisione doppia anziche float4
Questo metodo implementa le OGC Simple Features Implementation Specification for SQL 1.1. s2.1.1.1
Questo metodo implementa la specifica SQL/MM. SQL-MM 3: 5.1.19
SELECT ST_Envelope('POINT(1 3)'::geometry);
POINT(1 3)
SELECT ST_Envelope('LINESTRING(0 0,1 3)'::geometry);
POLYGON((0 0,0 3,1 3,1 0,0 0))
SELECT ST_Envelope('POLYGON((0 0,0 1,1.0000001 1,1.0000001 0,0 0))'::geometry);
POLYGON((0 0,0 1,1.0000001 1,1.0000001 0,0 0))
SELECT ST_Envelope('POLYGON((0 0,0 1,1.0000000001 1,1.0000000001 0,0 0))'::geometry);
POLYGON((0 0,0 1,1.0000000001 1,1.0000000001 0,0 0))
SELECT Box3D(geom), Box2D(geom), ST_Envelope(geom) As envelopewkt
FROM (SELECT 'POLYGON((0 0,0 1000012333334.34545678,1.0000001 1,1.0000001 0,0 0))'::geometry As geom) As foo;
Envelope of a point and LineString.
SELECT ST_Envelope(ST_Collect(
'LINESTRING(55 75,125 150)',
ST_Point(20, 80)
)) As wktenv;
POLYGON((20 75,20 150,125 150,125 75,20 75))