ST_BoxndfToGeom

更新时间:
复制 MD 格式

Converts a boxndf bounding box into a geometry object. The output dimensionality depends on which spatial dimensions the input box contains:

  • If the box includes the z dimension, the output is a three-dimensional geometry.

  • If the box does not include the z dimension, the output is a two-dimensional geometry.

  • If the box is missing the x or y dimension, the function returns NULL.

Syntax

geometry ST_BoxNDFToGeom(boxndf box);

Parameters

ParameterDescription
boxThe boxndf bounding box to convert.

Examples

Convert a 2D+time bounding box to a polygon

The following example creates a spatiotemporal bounding box using ST_MakeBox2dt (which includes x, y, and a time range) and converts it to a 2D polygon. The time dimension is discarded; only x and y are used.

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

Output:

             st_astext
------------------------------------
 POLYGON((0 0,0 20,20 20,20 0,0 0))