Convert a tbox to another type
tbox::{intspan,floatspan,tstzspan}
intspan(tbox) → tbox
floatspan(tbox) → tbox
tstzspan(tbox) → tbox
SELECT tbox 'TBOXINT XT([1,4),[2001-01-01,2001-01-02))'::intspan; -- [1,4) SELECT tbox 'TBOXFLOAT XT((1,2),[2001-01-01,2001-01-02))'::floatspan; -- (1, 2) SELECT tbox 'TBOXFLOAT XT((1,2),[2001-01-01,2001-01-02))'::tstzspan; -- [2001-01-01, 2001-01-02)
Convert another type to a tbox
{numbers,times,tnumber}::tbox
tbox({numbers,times,tnumber}) → tbox
SELECT intset '{1,2}'::tbox;
-- TBOXINT X([1, 3))
SELECT intspan '[1,3)'::tbox;
-- TBOXINT X([1, 3))
SELECT floatspan '(1.0,2.0)'::tbox;
-- TBOXFLOAT X((1, 2))
SELECT tstzspanset '{(2001-01-01,2001-01-02),(2001-01-03,2001-01-04)}'::tbox;
-- TBOX T((2001-01-01,2001-01-04))
Convert an stbox to a another type
stbox::{box2d,box3d,geo,tstzspan}
box2d(stbox) → box2d
box3d(stbox) → box3d
geometry(stbox) → geometry
geography(stbox) → geography
tstzspan(stbox) → tstzspan
SELECT stbox 'STBOX XT(((1.0,2.0),(3.0,4.0)),[2001-01-01,2001-01-03])'::box2d; -- BOX(1 2,3 4) SELECT ST_AsEWKT(stbox 'SRID=4326; STBOX XT(((1,1),(5,5)),[2001-01-01,2001-01-05])':: geometry); -- SRID=4326;POLYGON((1 1,1 5,5 5,5 1,1 1)) SELECT ST_AsEWKT(stbox 'STBOX XT(((1,1),(1,5)),[2001-01-01,2001-01-05])'::geometry); -- LINESTRING(1 1,1 5) SELECT ST_AsEWKT(stbox 'GEODSTBOX XT(((1,1),(1,1)),[2001-01-01,2001-01-05])'::geography); -- SRID=4326;POINT(1 1) SELECT ST_AsEWKT(stbox 'STBOX ZT(((1,1,1),(5,5,5)),[2001-01-01,2001-01-05])':: geometry); /* POLYHEDRALSURFACE(((1 1 1,1 5 1,5 5 1,5 1 1,1 1 1)), ((1 1 5,5 1 5,5 5 5,1 5 5,1 1 5)),((1 1 1,1 1 5,1 5 5,1 5 1,1 1 1)), ((5 1 1,5 5 1,5 5 5,5 1 5,5 1 1)),((1 1 1,5 1 1,5 1 5,1 1 5,1 1 1)), ((1 5 1,1 5 5,5 5 5,5 5 1,1 5 1))) */ SELECT stbox 'STBOX XT(((1.0,2.0),(3.0,4.0)),[2001-01-01,2001-01-03])'::tstzspan; -- [2001-01-01, 2001-01-03]
Convert another type to an stbox
{box2d,box3d,geo,time,tgeo}::stbox
stbox({box2d,box3d,geo,time,tgeo}) → stbox
SELECT geometry 'Linestring(1 1 1,2 2 2)'::box3d::stbox;
-- STBOX Z((1,1,1),(2,2,2))
SELECT geography 'Linestring(1 1,2 2)'::stbox;
-- SRID=4326;GEODSTBOX X((1,1),(2,2))
SELECT tstzspanset '{(2001-01-01,2001-01-02),(2001-01-03,2001-01-04)}'::stbox;
-- STBOX T((2001-01-01,2001-01-04))
The box of a geodetic temporal point holds the great circles it travels between its positions, which rise above them or fall below them: a trip from Point(10 60) to Point(50 60) reaches latitude 61.518762, and one whose positions lie more than half the globe apart in longitude crosses the antimeridian and spans every longitude.
SELECT stbox(tgeogpoint '[Point(10 60)@2001-01-01, Point(50 60)@2001-01-02]'); -- SRID=4326;GEODSTBOX XT(((10,60),(50,61.518762)),[2001-01-01, 2001-01-02]) SELECT stbox(tgeogpoint '[Point(-170 60)@2001-01-01, Point(170 60)@2001-01-02]'); -- SRID=4326;GEODSTBOX XT(((-180,60),(180,60.378349)),[2001-01-01, 2001-01-02])