Return the spatial reference identifier
SRID(geoset) → integer
SELECT SRID(geoset 'STBOX ZT(((1.0,2.0,3.0),(4.0,5.0,6.0)),[2001-01-01,2001-01-02])'); -- 0 SELECT SRID(geoset 'SRID=5676;STBOX XT(((1.0,2.0),(4.0,5.0)),[2001-01-01,2001-01-02])'); -- 5676 SELECT SRID(geoset 'GEODSTBOX T([2001-01-01,2001-01-02))'); -- ERROR: The box must have space dimension
Set the spatial reference identifier
setSRID(geoset) → geoset
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 different spatial reference
transform(geoset,to_srid integer) → geoset
transform(geoset,pipeline text,to_srid integer,is_forward bool=true) → geoset
The transform
function specifies the transformation with a target SRID. An error is raised when the input set 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 set is ignored, and the SRID of the output set 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(geoset, pipeline) AS ( SELECT geogset 'SRID=4326;{"Point(4.3525 50.846667 100.0)", "Point(-0.1275 51.507222 100.0)"}', text 'urn:ogc:def:coordinateOperation:EPSG::16031' ) SELECT asEWKT(transformPipeline(transformPipeline(geoset, pipeline, 4326), pipeline, 4326, false), 6) FROM test; -- SRID=4326;{"POINT Z (4.3525 50.846667 100)", "POINT Z (-0.1275 51.507222 100)"}