返回给定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。 |
示例
- 默认调用:
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)