TO_GEOGRAPHY
Parses an input and returns a value of type GEOGRAPHY.
TRY_TO_GEOGRAPHY returns a NULL value if an error occurs during parsing.
Syntax
TO_GEOGRAPHY(<string>)
TO_GEOGRAPHY(<binary>)
TO_GEOGRAPHY(<variant>)
TRY_TO_GEOGRAPHY(<string>)
TRY_TO_GEOGRAPHY(<binary>)
TRY_TO_GEOGRAPHY(<variant>)
Arguments
Return Type
Geography.
Examples
SELECT
ST_ASWKT(
TO_GEOGRAPHY(
'POINT(1 2)'
)
) AS pipeline_geography;
┌────────────────────┐
│ pipeline_geography │
├────────────────────┤
│ POINT(1 2) │
└────────────────────┘
SELECT
ST_ASWKT(
TO_GEOGRAPHY(
FROM_HEX('0101000000000000000000F03F0000000000000040')
)
) AS pipeline_geography;
┌────────────────────┐
│ pipeline_geography │
├────────────────────┤
│ POINT(1 2) │
└────────────────────┘
SELECT
ST_ASWKT(
TO_GEOGRAPHY(
PARSE_JSON('{"type":"Point","coordinates":[1,2]}')
)
) AS pipeline_geography;
┌────────────────────┐
│ pipeline_geography │
├────────────────────┤
│ POINT(1 2) │
└────────────────────┘