All Products
Search
Document Center

MaxCompute:ST_ASTEXT

Last Updated:Aug 26, 2026

ST_ASTEXT returns the Well-Known Text (WKT) representation of a GEOGRAPHY value as a STRING.

Syntax

STRING ST_ASTEXT(GEOGRAPHY <value>)

Parameters

value: Required. A value of the GEOGRAPHY data type. You can use functions such as ST_GEOGPOINT, ST_GEOGFROMWKB, ST_GEOGFROMTEXT, ST_MAKELINE, and ST_MAKEPOLYGON to create GEOGRAPHY objects.

Return value

Returns the WKT representation of the GEOGRAPHY value as a STRING.

Examples

  • Example 1: Create a point using the ST_GEOGPOINT function and return its WKT representation.

    SELECT ST_ASTEXT(ST_GEOGPOINT(3, 4));
    
    -- Returns:
    +-------------+
    | _c0         |
    +-------------+
    | POINT (3 4) |
    +-------------+
  • Example 2: Create a linestring from two points, (0, 0) and (3, 4), using the ST_MAKELINE function and return its WKT representation.

    SELECT ST_ASTEXT(ST_MAKELINE(ST_GEOGPOINT(0, 0), ST_GEOGPOINT(3, 4)));
    
    -- Returns:
    +-----------------------+
    | _c0                   |
    +-----------------------+
    | LINESTRING (0 0, 3 4) |
    +-----------------------+

Related topics