适用于:
Databricks SQL
Databricks Runtime 17.1 及更高版本
Important
此功能目前以公共预览版提供。
注释
此功能在 Databricks SQL 经典仓库上不可用。 若要详细了解 Databricks SQL 仓库,请参阅 SQL 仓库类型。
分析地理位置的输入说明并返回相应的 GEOGRAPHY 值。
返回 GEOGRAPHY 值的 SRID 值为 4326。
Syntax
to_geography ( geoRepExpr )
Arguments
Returns
一个类型 GEOGRAPHY(ANY)值,对应于输入地理说明。
如果输入为 NULL.,则函数返回 NULL 。
错误条件
- 如果
geoRepExpr类型为类型BINARY且值为无效的 WKB,则函数将返回 WKB_PARSE_ERROR。 - 如果
geoRepExpr类型为类型STRING且值无效的 WKT,则函数将返回 WKT_PARSE_ERROR。 - 如果
geoRepExpr类型为,STRING并且值无效 GeoJSON,则函数将返回 GEOJSON_PARSE_ERROR。
Examples
-- Input geography is in WKT format.
> SELECT st_asgeojson(to_geography('POINT Z (3 4 5)'));
{"type":"Point","coordinates":[3,4,5]}
-- Input geography is in GeoJSON format.
> SELECT st_asewkt(to_geography('{"type":"Point","coordinates":[3,4,5]}'));
SRID=4326;POINT Z (3 4 5)
-- Input geography is in WKB format.
> SELECT st_astext(to_geography(X'01b90b0000000000000000084000000000000010400000000000001440000000000000f0bf'))
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_geometry函数 -
try_to_geography函数 -
try_to_geometry函数