ST_MakeBox{Z|T|2D|2DT|3D|3DT}

Updated at:

Constructs a bounding box from the specified axis bounds.

Syntax

boxndf ST_MakeBoxZ(float8 zmin, float8 zmax);
boxndf ST_MakeBoxT(timestamp tmin, timestamp tmax);
boxndf ST_MakeBox2D(float8 xmin, float8 ymin, float8 xmax, float8 ymax);
boxndf ST_MakeBox2DT(float8 xmin, float8 ymin, timestamp tmin, float8 xmax, float8 yax, timestamp tmax);
boxndf ST_MakeBox3D(float8 xmin, float8 ymin, float8 zmin, float8 xmax, float8 ymax, float8 zmax);
boxndf ST_MakeBox3DT(float8 xmin, float8 ymin, float8 zmin, timestamp tmin, float8 xmax, float8 ymax, float8 zmax, timestamp tmax);

Parameters

ParameterDescription
xminThe lower bound on the x axis of the bounding box.
xmaxThe upper bound on the x axis of the bounding box.
yminThe lower bound on the y axis of the bounding box.
ymaxThe upper bound on the y axis of the bounding box.
zminThe lower bound on the z axis of the bounding box.
zmaxThe upper bound on the z axis of the bounding box.
tminThe lower bound on the t axis of the bounding box.
tmaxThe upper bound on the t axis of the bounding box.

Description

Each function variant constructs a bounding box for the dimensions indicated by its name suffix: Z (elevation), T (time), 2D (x and y), 2DT (x, y, and time), 3D (x, y, and z), or 3DT (x, y, z, and time). All variants return a value of type boxndf.

Bounding boxes use the FLOAT data type internally, so the returned box may be slightly larger than the input bounds. The lower bound may be marginally smaller than the specified value, and the upper bound may be marginally larger.

Examples

SELECT ST_MakeBox2d(0,0,3,3);
  st_makebox2d
----------------
 BOX2D(0 0,3 3)

The following example demonstrates the FLOAT precision behavior. The input bounds 2000-01-01 00:00:03 and 2000-01-01 02:46:40 are slightly expanded in the output.

SELECT ST_MakeBox3dt(0,0,3,'2000-01-01 00:00:03'::timestamp, 2,5,4,'2000-01-01 02:46:40'::timestamp);
                              st_makebox3dt
---------------------------------------------------------------------------
 BOX3DT(0 0 3 2000-01-01 00:00:02.999999,2 5 4 2000-01-01 02:46:40.000476)
(1 row)