Nota
El acceso a esta página requiere autorización. Puede intentar iniciar sesión o cambiar directorios.
El acceso a esta página requiere autorización. Puede intentar cambiar los directorios.
适用于: Databricks Runtime 17.1 及更高版本
重要
此功能目前以公共预览版提供。
分析几何图形的输入说明并返回相应的 GEOMETRY
值。
返回 GEOMETRY
值的 SRID 值取决于输入格式。
语法
to_geometry ( geoRepExpr )
论据
-
geoRepExpr
:表示 WKB、WKT、GeoJSON 或扩展 WKB(EWKB)中的几何图形的表达式BINARY
STRING
。
退货
一个类型 GEOMETRY(ANY)
值,对应于输入地理说明。
如果输入为 NULL
.,则函数返回 NULL
。
错误条件
- 如果
geoRepExpr
类型为类型BINARY
且值为无效的 EWKB,则函数将返回 EWKB_PARSE_ERROR。 - 如果
geoRepExpr
类型为类型BINARY
且值为无效的 WKB,则函数将返回 WKB_PARSE_ERROR。 - 如果
geoRepExpr
类型为类型STRING
且值无效的 WKT,则函数将返回 WKT_PARSE_ERROR。 - 如果
geoRepExpr
类型为,STRING
并且值无效 GeoJSON,则函数将返回 GEOJSON_PARSE_ERROR。
例子
-- Input geometry is in WKT format.
> SELECT st_asgeojson(to_geometry('POINT Z (3 4 5)'));
{"type":"Point","coordinates":[3,4,5]}
-- Input geometry is in GeoJSON format.
> SELECT st_astext(to_geometry('{"type":"Point","coordinates":[3,4,5]}'));
POINT Z (3 4 5)
-- Input geometry is in WKB format.
> SELECT st_astext(to_geometry(X'0101000060110f0000000000000000084000000000000010400000000000001440'));
POINT M (3 4 5)
-- Input geometry is in EWKB format.
> SELECT st_asewkt(to_geometry(X'01010000E0110F0000000000000000084000000000000010400000000000001440000000000000F0BF'));
SRID=3857;POINT ZM (3 4 5 -1)
相关函数
-
st_asbinary
函数 -
st_asewkb
函数 -
st_asewkt
函数 -
st_asgeojson
函数 -
st_astext
函数 -
st_aswkb
函数 -
st_aswkt
函数 -
st_geogfromgeojson
函数 -
st_geogfromtext
函数 -
st_geogfromwkb
函数 -
st_geogfromwkt
函数 -
st_geomfromewkb
函数 -
st_geomfromgeojson
函数 -
st_geomfromtext
函数 -
st_geomfromwkb
函数 -
st_geomfromwkt
函数 -
to_geography
函数 -
try_to_geography
函数 -
try_to_geometry
函数