适用于: Databricks Runtime 17.1 及更高版本
重要
此功能目前以公共预览版提供。
分析地理位置的输入说明并返回相应的 GEOGRAPHY
值;如果输入说明无效,则返回 NULL
。
返回 GEOGRAPHY
值的 SRID 值为 4326。
语法
try_to_geography ( geoRepExpr )
论据
-
geoRepExpr
:一个以 WKB、WKT 或 GeoJSON 表示地理位置的BINARY
或STRING
表达式。
退货
一个类型 GEOGRAPHY(ANY)
值,对应于输入地理说明。
- 如果输入为
NULL
.,则函数返回NULL
。 - 如果输入
NULL
或BINARY
的值是地理的无效描述,则函数将返回STRING
。
例子
-- Input geography is in WKT format.
> SELECT SELECT st_asgeojson(try_to_geography('POINT Z (3 4 5)'));
{"type":"Point","coordinates":[3,4,5]}
-- Input geography is in GeoJSON format.
> SELECT st_asewkt(try_to_geography('{"type":"Point","coordinates":[3,4,5]}'));
SRID=4326;POINT Z (3 4 5)
-- Input geography is in WKB format.
> SELECT st_astext(try_to_geography(X'01b90b0000000000000000084000000000000010400000000000001440000000000000f0bf'));
POINT ZM (3 4 5 -1)
-- Input value is not the description of a geography.
> SELECT st_astext(try_to_geography('some string that does not represent a geography'));
NULL
相关函数
-
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
函数 -
to_geometry
函数 -
try_to_geometry
函数