Convertir un tbox
a otro tipo
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)
Convertir otro tipo a un 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))
Convertir un stbox
a otro tipo
stbox::{box2d,box2d,geo,tstzspan}
box2d(stbox) → box2d
box3d(stbox) → box2d
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]
Convertir otro tipo a un stbox
{box2d,box3d,geo,times,tpoint}::stbox
stbox({box2d,box3d,geo,times,tpoint}) → 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))