适用于:
Databricks SQL
Databricks 运行时 17.1 及以上
Lakehouse//RT
注释
此功能在 Databricks SQL 经典仓库上不可用。 若要详细了解 Databricks SQL 仓库,请参阅 SQL 仓库类型。
分析几何图形的 WKT 说明并返回相应的 GEOMETRY 值。
返回 GEOMETRY 值的 SRID 值是指定的值 sridExpr ,否则为 0。
Syntax
st_geomfromtext ( wktExpr[, sridExpr] )
Arguments
-
wktExpr:一个STRING值,表示 WKT 格式中的几何体。 -
sridExpr:INTEGER一个可选值,设置为返回值的GEOMETRYSRID。
Returns
GEOMETRY(srid) 类型的值,其中,如果 srid 是常量(可折叠)表达式,则 sridExpr 是 sridExpr 的值,否则为 GEOMETRY(ANY)。
如果 sridExpr 省略返回值的类型为 GEOMETRY(0)。
返回的值是对应于输入 WKT 说明的几何图形。
如果任何输入为NULL,该函数将返回NULL。
错误条件
- 如果
wktExpr的值为无效的 WKT 说明,则函数将返回 WKT_PARSE_ERROR。 - 如果不支持该值
sridExpr,则函数返回ST_INVALID_SRID_VALUE。
Examples
-- Simple example where we do not specify the output SRID. It defaults to 0.
> SELECT st_srid(st_geomfromtext('POINT Z (1 2 3)'));
0
-- Simple example where we specify the SRID value for the output.
> SELECT st_asewkt(st_geomfromtext('POINT Z (1 2 3)', 3857));
SRID=3857;POINT Z (1 2 3)
-- When invoking st_geomfromtext with a literal for the SRID value, the output geometry type inherits the SRID value.
> SELECT typeof(st_geomfromtext('POINT Z (1 2 3)', 4269));
geometry(4269)
相关函数
-
st_asbinary函数 -
st_asewkb函数 -
st_asewkt函数 -
st_asgeojson函数 -
st_astext函数 -
st_geogfromewkt函数 -
st_geogfromgeojson函数 -
st_geogfromtext函数 -
st_geogfromwkb函数 -
st_geogfromwkt函数 -
st_geomfromewkb函数 -
st_geomfromewkt函数 -
st_geomfromgeojson函数 -
st_geomfromwkb函数 -
st_geomfromwkt函数 -
to_geography函数 -
to_geometry函数 -
try_to_geography函数 -
try_to_geometry函数