全部產品
Search
文件中心

PolarDB:ST_AsEWKT

更新時間:Jul 06, 2024

返回給定Geometry或Geography對象的擴充WKT表示,其中包含SRID中繼資料。

文法

text ST_AsEWKT(geometry g1);
text ST_AsEWKT(geography g1);

參數

參數名稱描述
g1目標Geometry/Geography對象。

描述

  • 想獲得不包含SRID的標準WKT對象,請調用ST_AsText函數。
  • WKT格式不能保持精度,因此為了防止浮點精度被截斷,請使用ST_AsBinaryST_AsEWKB格式進行傳輸。
  • 該函數支援Circular Strings、Curves、Polyhedral surfaces、Triangles、Triangulated Irregular Network Surfaces(TIN)和3D對象。

樣本

  • 帶有SRID的對象:
    SELECT ST_AsEWKT(ST_GeomFromText('POLYGON((1 1,1 2,2 2,2 1,1 1))',4326));
                    st_asewkt
    ------------------------------------------
     SRID=4326;POLYGON((1 1,1 2,2 2,2 1,1 1))
    (1 row)
  • 不帶SRID的對象:
    SELECT ST_AsEWKT(ST_GeomFromText('POLYGON((1 1,1 2,2 2,2 1,1 1))'));
               st_asewkt
    --------------------------------
     POLYGON((1 1,1 2,2 2,2 1,1 1))
    (1 row)