ST_TransformPipeline — 定義されている座標変換パイプラインを使用して異なる空間参照系に変換された新しいジオメトリを返します。
geometry ST_TransformPipeline(geometry g1, text pipeline, integer to_srid);
定義されている座標変換パイプラインを使用して異なる空間参照系に変換された新しいジオメトリを返します。
変換パイプラインは次の文字列書式のいずれかをつかって定義されます。
urn:ogc:def:coordinateOperation:AUTHORITY::CODE。単純なEPSG:CODE文字列は座標操作を一意に識別できません。CRS定義に同じEPSGコードが使用できるためです。
PROJパイプライン文字列: +proj=pipeline ...。自動の軸正規化が適用されません。必要なら呼び出し元が追加のパイプライン段階を必要とします。もしくはaxisswap段階を削除する必要があります。
操作の連結: urn:ogc:def:coordinateOperation,coordinateOperation:EPSG::3895,coordinateOperation:EPSG::1618。
Availability: 3.4.0
入力ジオメトリのSRIDは無視され、任意パラメータ to_srid から値が提供されていない場合には出力ジオメトリのSRIDは0に設定されます。`ST_TransformPipeline()`を使うときには、パイプラインが順方向に実行されます。ST_InverseTransformPipelineを使うと、パイプラインは逆方向に実行されます。
パイプラインを用いた変換はST_Transformの特別版です。ほとんどの場合、`ST_Transform`は、座標系間の変換において正しい演算子を選択します。こちらの方が推奨されます。
EPSG:16031変換を使ったWGS 84 経度緯度から UTM31Nへの変換
-- 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の例。
-- 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)