Return or set the spatial reference identifier
SRID(stbox) → integer
setSRID(stbox) → stbox
SELECT SRID(stbox 'STBOX ZT(((1.0,2.0,3.0),(4.0,5.0,6.0)),[2001-01-01,2001-01-02])'); -- 0 SELECT SRID(stbox 'SRID=5676;STBOX XT(((1.0,2.0),(4.0,5.0)),[2001-01-01,2001-01-02])'); -- 5676 SELECT SRID(stbox 'GEODSTBOX T([2001-01-01,2001-01-02))'); -- ERROR: The box must have space dimension
SELECT setSRID(stbox 'STBOX ZT(((1.0,2.0,3.0),(4.0,5.0,6.0)), [2001-01-01,2001-01-02])', 5676); -- SRID=5676;STBOX ZT(((1,2,3),(4,5,6)),[2001-01-01,2001-01-02])
Transform to a spatial reference identifier
transform(stbox,to_srid integer) → stbox
transformPipeline(stbox,pipeline text,to_srid integer,is_forward bool=true) → stbox
The transform
function specifies the transformation with a target SRID. An error is raised when the input box has an unknown SRID (represented by 0). The transformPipeline
function specifies the transformation with a defined coordinate transformation pipeline represented with the following string format:
urn:ogc:def:coordinateOperation:AUTHORITY::CODE
The SRID of the input box is ignored, and the SRID of the output box will be set to zero unless a value is provided via the optional to_srid
parameter. As stated by the last parameter, the pipeline is executed by default in a forward direction; by setting the parameter to false, the pipeline is executed in the inverse direction.
SELECT round(transform(stbox 'SRID=4326;STBOX XT(((2.340088, 49.400250), (6.575317, 51.553167)),[2001-01-01,2001-01-02])', 3812), 6); /* SRID=3812;STBOX XT(((502773.429981,511805.120402),(803028.908265,751590.742629)), [2001-01-01, 2001-01-02]) */ WITH test(box, pipeline) AS ( SELECT stbox 'SRID=4326;GEODSTBOX Z((-0.1275,50.846667,100),(4.3525,51.507222,100))', text 'urn:ogc:def:coordinateOperation:EPSG::16031' ) SELECT asEWKT(transformPipeline(transformPipeline(box, pipeline, 4326), pipeline, 4326, false), 6) FROM test; -- SRID=4326;GEODSTBOX Z((-0.1275,50.846667,100),(4.3525,51.507222,100))