Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Parses the input description of a geography and returns the corresponding GEOGRAPHY
value, or NULL
if the input description is invalid.
The SRID value of the returned GEOGRAPHY
value is 4326.
Syntax
try_to_geography ( geoRepExpr )
Arguments
Returns
A value of type GEOGRAPHY(ANY)
, corresponding to the input geography description.
- The function returns
NULL
if the input isNULL
. - The function returns
NULL
if the inputBINARY
orSTRING
value is an inalid description of a geography.
Examples
-- 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
Related functions
st_asbinary
functionst_asewkb
functionst_asewkt
functionst_asgeojson
functionst_astext
functionst_aswkb
functionst_aswkt
functionst_geogfromgeojson
functionst_geogfromtext
functionst_geogfromwkb
functionst_geogfromwkt
functionst_geomfromewkb
functionst_geomfromgeojson
functionst_geomfromtext
functionst_geomfromwkb
functionst_geomfromwkt
functionto_geography
functionto_geometry
functiontry_to_geometry
function