名称

ST_TransformPipeline — 返回一个新的几何图形,其坐标使用定义的坐标转换管道转换为不同的空间参考系统。

大纲

geometry ST_TransformPipeline(geometry g1, text pipeline, integer to_srid);

描述

返回一个新的几何图形,其坐标使用定义的坐标转换管道转换为不同的空间参考系统。

转换管道使用以下任意字符串格式定义:

  • urn:ogc:def:coordinateOperation:AUTHORITY::CODE。 请注意,简单的 EPSG:CODE 字符串不能唯一标识坐标操作:相同的 EPSG 代码可用于 CRS 定义。

  • PROJ 管道字符串的形式为: proj=pipeline .... 将不会应用自动轴规范化,并且如有必要,调用者将需要添加额外的管道步骤,或删除 axisswap 步骤。

  • 形式的串联操作:urn:ogc:def:coordinateOperation,coordinateOperation:EPSG::3895,coordinateOperation:EPSG::1618

可用性:3.4.0

输入几何体的 SRID 将被忽略,输出几何体的 SRID 将设置为零,除非通过可选的 to_srid 参数提供值。 当使用“ST_TransformPipeline()”时,管道将向前执行。 使用 ST_InverseTransformPipeline管道以相反方向执行。

使用管道的转换是ST_Transform 的专门版本。 在大多数情况下,“ST_Transform”将选择正确的操作在坐标系之间进行转换,并且应该是首选。

示例

使用 EPSG:16031 转换将 WGS 84 经纬度更改为 UTM 31N

This example transforms in the forward direction.

Code
SELECT
    ST_SetSRID(ST_TransformPipeline(
        'SRID=4326;POINT(2 49)'::geometry,
        'urn:ogc:def:coordinateOperation:EPSG::16031'
    ), 32631) AS utm_geom;
栅格输出
SRID=32631;POINT(426857.9877165967 5427937.523342293)
Figure
Geometry figure for visual-st-transformpipeline-01

This example transforms in the inverse direction.

Code
SELECT
    ST_SetSRID(ST_InverseTransformPipeline(
        'SRID=32631;POINT(426857.9877165967 5427937.523342293)'::geometry,
        'urn:ogc:def:coordinateOperation:EPSG::16031'
    ), 4326) AS wgs_geom;
栅格输出
SRID=4326;POINT(2 48.99999999999999)
Figure
Geometry figure for visual-st-transformpipeline-02

GDA2020示例。

This example uses ST_Transform with automatic selection of a conversion pipeline.

Code
SELECT ST_Transform('SRID=4939;POINT(143.0 -37.0)'::geometry, 7844) AS gda2020_auto;
栅格输出
POINT(143.00000635638918 -36.999986706128176)
Figure
Geometry figure for visual-st-transformpipeline-03

Using a defined conversion (EPSG:8447)

Code
SELECT
    ST_TransformPipeline(
        'SRID=4939;POINT(143.0 -37.0)'::geometry,
        'urn:ogc:def:coordinateOperation:EPSG::8447'
    ) AS gda2020_code;
栅格输出
POINT(143.0000063280214 -36.999986718287545)

This example uses a PROJ pipeline definition matching EPSG:8447, as returned from projinfo. Any axisswap steps must be removed.

Code
SELECT
    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;
栅格输出
POINT(143.0000063280214 -36.999986718287545)