Return or set the spatial reference identifier
SRID(spatialset) → integer
setSRID(spatialset) → spatialset
SELECT SRID(geomset '{Point(1 1), Point(2 2)}');
-- 0
SELECT SRID(geogset '{"Linestring(1 1,2 2)","Polygon((1 1,1 2,2 2,2 1,1 1))"}');
-- 4326
SELECT SRID(geomset 'SRID=5676;{"Linestring(1 1,2 2)","Polygon((1 1,1 2,2 2,2 1,1 1))"}');
-- 5676
SELECT asEWKT(setSRID(geomset '{Point(1 1), Point(2 2)}', 5676));
-- SRID=5676;{"POINT(1 1)", "POINT(2 2)"}
SELECT asEWKT(setSRID(poseset '{"Pose(Point(1 1),1)", "Pose(Point(2 2),3)"}', 5676));
-- SRID=5676;{"Pose(POINT(2 2),3)", "Pose(POINT(1 1),1)"}
Transform to a spatial reference identifier
transform(spatialset,to_srid integer) → spatialset
transformPipeline(spatialset,pipeline text,to_srid integer,is_forward bool=true) →
spatialset
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 coordinate transformation pipeline in the following 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 asEWKT(transform(geomset 'SRID=4326;{Point(2.340088 49.400250),
Point(6.575317 51.553167)}', 3812), 6);
-- SRID=3812;{"POINT(502773.429981 511805.120402)", "POINT(803028.908265 751590.742629)"}
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)"}