ST_TransformPipeline — Returnerar en ny geometri med koordinater som transformerats till ett annat spatialt referenssystem med hjälp av en definierad pipeline för koordinattransformation.
geometry ST_TransformPipeline(geometry g1, text pipeline, integer to_srid);
Returnerar en ny geometri med koordinater som transformerats till ett annat spatialt referenssystem med hjälp av en definierad pipeline för koordinattransformation.
Transformationspipelines definieras med hjälp av något av följande strängformat:
urn:ogc:def:coordinateOperation:AUTHORITY::CODE. Observera att en enkel EPSG:CODE -sträng inte identifierar en koordinatoperation på ett unikt sätt: samma EPSG-kod kan användas för en CRS-definition.
En PROJ-pipeline-sträng av formen: +proj=pipeline .... Automatisk axelnormalisering kommer inte att tillämpas och vid behov måste den som ringer lägga till ytterligare ett pipelinesteg eller ta bort axelbytessteg.
Sammanlänkade operationer av formen: urn:ogc:def:coordinateOperation,coordinateOperation:EPSG::3895,coordinateOperation:EPSG::1618.
Tillgänglighet: 3.4.0
SRID för inmatningsgeometrin ignoreras och SRID för utdatageometrin kommer att sättas till noll om inte ett värde anges via den valfria parametern to_srid. När du använder `ST_TransformPipeline()` körs pipelinen i framåtriktad riktning. Om du använder ST_InverseTransformPipeline körs pipelinen i omvänd riktning.
Transformationer som använder pipelines är en specialiserad version av ST_Transform. I de flesta fall väljer `ST_Transform` rätt operationer för att konvertera mellan koordinatsystem, och bör därför föredras.
Ändra WGS 84 long lat till UTM 31N med hjälp av EPSG:16031-omvandlingen
-- Forward direction
SELECT ST_AsText(ST_TransformPipeline('SRID=4326;POINT(2 49)'::geometry,
'urn:ogc:def:coordinateOperation:EPSG::16031')) AS utm_geom;
utm_geom
--------------------------------------------
POINT(426857.9877165967 5427937.523342293)
(1 row)
-- Inverse direction
SELECT ST_AsText(ST_InverseTransformPipeline('POINT(426857.9877165967 5427937.523342293)'::geometry,
'urn:ogc:def:coordinateOperation:EPSG::16031')) AS wgs_geom;
wgs_geom
----------------------------
POINT(2 48.99999999999999)
(1 row)
GDA2020 exempel.
-- using ST_Transform with automatic selection of a conversion pipeline.
SELECT ST_AsText(ST_Transform('SRID=4939;POINT(143.0 -37.0)'::geometry, 7844)) AS gda2020_auto;
gda2020_auto
-----------------------------------------------
POINT(143.00000635638918 -36.999986706128176)
(1 row)
-- using a defined conversion (EPSG:8447)
SELECT ST_AsText(ST_TransformPipeline('SRID=4939;POINT(143.0 -37.0)'::geometry,
'urn:ogc:def:coordinateOperation:EPSG::8447')) AS gda2020_code;
gda2020_code
----------------------------------------------
POINT(143.0000063280214 -36.999986718287545)
(1 row)
-- using a PROJ pipeline definition matching EPSG:8447, as returned from
-- 'projinfo -s EPSG:4939 -t EPSG:7844'.
-- NOTE: any 'axisswap' steps must be removed.
SELECT ST_AsText(ST_TransformPipeline('SRID=4939;POINT(143.0 -37.0)'::geometry,
'+proj=pipeline
+step +proj=unitconvert +xy_in=deg +xy_out=rad
+step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif
+step +proj=unitconvert +xy_in=rad +xy_out=deg')) AS gda2020_pipeline;
gda2020_pipeline
----------------------------------------------
POINT(143.0000063280214 -36.999986718287545)
(1 row)