Constructs a rectangular polygon (bounding box) from the specified minimum and maximum coordinate values.
Syntax
geometry ST_MakeEnvelope(double precision xmin, double precision ymin, double precision xmax, double precision ymax, integer srid)Parameters
| Parameter | Type | Description |
|---|---|---|
xmin | double precision | The minimum x coordinate. |
ymin | double precision | The minimum y coordinate. |
xmax | double precision | The maximum x coordinate. |
ymax | double precision | The maximum y coordinate. |
srid | integer | The spatial reference identifier (SRID) that defines the coordinate system for the polygon. Default value: 0 (unknown). |
Usage notes
The coordinate values must fall within the value range supported by the specified SRID.
Example: Build a bounding box polygon
SELECT ST_AsText(ST_MakeEnvelope(1, 2, 3, 4, 4326));Output:
st_astext
--------------------------------
POLYGON((1 2,1 4,3 4,3 2,1 2))
(1 row)该文章对您有帮助吗?