ST_{X|Y|Z|T}Min

Updated at:

Returns the minimum value of a bounding box along a specified dimension.

Syntax

float8 ST_XMin(boxndf box);
float8 ST_YMin(boxndf box);
float8 ST_ZMin(boxndf box);
timestamp ST_TMin(boxndf box);

Parameters

ParameterDescription
boxThe bounding box to query.

Return values

FunctionReturn typeDescription
ST_XMinfloat8The minimum x value of the bounding box. Returns NaN if the bounding box has no x dimension.
ST_YMinfloat8The minimum y value of the bounding box. Returns NaN if the bounding box has no y dimension.
ST_ZMinfloat8The minimum z value of the bounding box. Returns NaN if the bounding box has no z dimension.
ST_TMintimestampThe minimum t (time) value of the bounding box. Returns -infinity if the bounding box has no t dimension.

Usage notes

  • For x, y, and z dimensions, if the bounding box does not have the specified dimension, the function returns NaN.

  • For the t dimension, if the bounding box does not have a t dimension, the function returns -infinity.

Examples

Query the minimum x value of a 2D bounding box with a time range:

SELECT ST_XMin(ST_MakeBox2dt(0,0,'2000-01-01'::timestamp, 20,20, '2020-01-01'::timestamp));

Result:

 st_xmin
---------
       0

Query the minimum z value of a 2D bounding box with a time range. Because the box has no z dimension, the function returns NaN:

SELECT ST_ZMin(ST_MakeBox2dt(0,0,'2000-01-01'::timestamp, 20,20, '2020-01-01'::timestamp));

Result:

 st_zmin
---------
     NaN

Query the minimum t value of a 2D bounding box. Because the box has no t dimension, the function returns -infinity:

SELECT ST_TMin(ST_MakeBox2d(0,0, 20,20));

Result:

  st_tmin
-----------
 -infinity