st_astext function

适用于:勾选为是 Databricks SQL 勾选为是 Databricks 运行时 17.1 及以上 勾选 是 Lakehouse//RT

Important

支持 GEOGRAPHY 值以 公共预览版提供。 对 GEOMETRY 值的支持 已正式发布。

注释

此功能在 Databricks SQL 经典仓库上不可用。 若要详细了解 Databricks SQL 仓库,请参阅 SQL 仓库类型。

以 GEOGRAPHY 格式返回输入GEOMETRY或值。

Syntax

st_astext ( geoExpr )

Arguments

  • geoExpr: A GEOGRAPHY 或 GEOMETRY value。

Returns

一个 STRING 类型的值。 返回的值是输入或GEOGRAPHY值的 GEOMETRY 说明。

如果输入为 NULL.,则函数返回 NULL 。

Examples

-- Export a 3DZ Cartesian point, given in GeoJSON format, in WKT format.
> SELECT st_astext(to_geometry('{"type":"Point","coordinates":[2.718281828,3.141592653,100]}'));
  POINT Z (2.718281828 3.141592653 100)

-- Export a 3DZ geographic point, given in GeoJSON format, in WKT format.
> SELECT st_astext(to_geography('{"type":"Point","coordinates":[2.718281828,3.141592653,100]}'));
  POINT Z (2.718281828 3.141592653 100)