全部產品
Search
文件中心

PolarDB:ST_Transform

更新時間:Jul 06, 2024

將傳入的Geometry對象的座標參考系轉換成指定的座標參考系,並返回。

文法

geometry ST_Transform(geometry g1 , integer srid);
geometry ST_Transform(geometry geom , text toProj);
geometry ST_Transform(geometry geom , text fromProj , text toProj);
geometry ST_Transform(geometry geom , text fromProj , integer toSrid);

參數

參數名稱描述
g1/geom目標Geometry對象。
srid/toSrid指定的目的座標系的SRID標識(必須存在於space_ref_sys表中)。
toProj指定的目的座標系的Proj表達字串。
fromProj目標對象的源座標系的Proj表達字串。

描述

該函數支援Circular Strings、Curves、Polyhedral surfaces對象。

樣本

SELECT ST_AsEWKT(ST_Transform(ST_GeomFromText('LINESTRING(2 1,1 1)',4326),3857));
                           st_asewkt
---------------------------------------------------------------
 SRID=3857;LINESTRING(222638.981586547 111325.142866385,111319.
..490793274 111325.142866385)
(1 row)