ST_AsText
更新時間:
Copy as MD
返回給定Geometry對象或Geography對象的WKT表示,不包含SRID中繼資料。
文法
text ST_AsText(geometry g1);
text ST_AsText(geometry g1 , integer maxdecimaldigits);
text ST_AsText(geography g1);
text ST_AsText(geography g1 , integer maxdecimaldigits);參數
參數名稱 | 描述 |
g1 | 目標Geometry/Geography對象。 |
maxdecimaldigits | 最大小數位元。預設為15。 |
描述
要將SRID作為資料的一部分,請使用非標準的ST_AsEWKT函數。
WKT格式不能保持精度,因此為了防止浮點值截斷,請使用ST_AsBinary或ST_AsEWKB格式進行傳輸。
樣本
預設調用:
SELECT ST_AsText(ST_GeomFromText('POINT(116 40)',4326)); st_astext --------------- POINT(116 40) (1 row)指定位元:
SELECT ST_AsText(ST_GeomFromText('POINT(116.112 40.412)',4326),2); st_astext --------------------- POINT(116.11 40.41) (1 row)
该文章对您有帮助吗?