All Products
Search
Document Center

MaxCompute:ST_GEOGFROMTEXT

Last Updated:Aug 26, 2026

The ST_GEOGFROMTEXT function converts a string in Well-Known Text (WKT) format to a geography object.

Syntax

GEOGRAPHY ST_GEOGFROMTEXT(STRING <WKT>)

Parameters

WKT: Required. A string in WKT format. This function does not support the Z (elevation) or M (measure) dimensions. For more information, see GEOGRAPHY data type.

Return value

Returns a geography object. The system validates the input by internally converting it to an S2 geography library object.

The S2 geography library uses the DOUBLE data type to represent the coordinates of a geography object. This conversion can cause minor precision loss, resulting in slight differences between the input and output.

Examples

SELECT ST_GEOGFROMTEXT('POINT (10 20)');
-- Result:
+---------------+
| _c0           |
+---------------+
| POINT (10 20) |
+---------------+

SELECT ST_GEOGFROMTEXT('POINT EMPTY');
-- Result:
+--------------------------+
| _c0                      |
+--------------------------+
| GEOMETRYCOLLECTION EMPTY |
+--------------------------+

SELECT ST_GEOGFROMTEXT('LINESTRING (10 20, 30 50, 70 80)');
-- Result:
+----------------------------------+
| _c0                              |
+----------------------------------+
| LINESTRING (10 20, 30 50, 70 80) |
+----------------------------------+

SELECT ST_GEOGFROMTEXT('POLYGON ((-10 -10, 10 -10, 10 10, -10 10, -10 -10), (-5 -5, 5 -5, 5 5, -5 5, -5 -5))');
-- Result:
+--------------------------------------------------------------------------------------+
| _c0                                                                                  |
+--------------------------------------------------------------------------------------+
| POLYGON ((-10 -10, 10 -10, 10 10, -10 10, -10 -10), (-5 -5, 5 -5, 5 5, -5 5, -5 -5)) |
+--------------------------------------------------------------------------------------+

Related topics