Skip to main content

ST_ASWKT

Introduced or updated: v1.2.436

Converts a GEOMETRY or GEOGRAPHY object into a WKT(well-known-text) format representation.

Syntax​

ST_ASWKT(<geometry_or_geography>)

Aliases​

Arguments​

ArgumentsDescription
<geometry_or_geography>The argument must be an expression of type GEOMETRY or GEOGRAPHY.

Return Type​

String.

Examples​

GEOMETRY examples​

SELECT
ST_ASWKT(
ST_GEOMETRYFROMWKT(
'SRID=4326;LINESTRING(400000 6000000, 401000 6010000)'
)
) AS pipeline_wkt;

┌───────────────────────────────────────────┐
│ pipeline_wkt │
├───────────────────────────────────────────┤
│ LINESTRING(400000 6000000,401000 6010000) │
└───────────────────────────────────────────┘

SELECT
ST_ASTEXT(
ST_GEOMETRYFROMWKT(
'SRID=4326;POINT(-122.35 37.55)'
)
) AS pipeline_wkt;

┌──────────────────────┐
│ pipeline_wkt │
├──────────────────────┤
│ POINT(-122.35 37.55) │
└──────────────────────┘

GEOGRAPHY examples​

SELECT
ST_ASWKT(
ST_GEOGFROMWKT(
'SRID=4326;POINT(-122.35 37.55)'
)
) AS pipeline_wkt;

╭──────────────────────╮
│ pipeline_wkt │
├──────────────────────┤
│ POINT(-122.35 37.55) │
╰──────────────────────╯
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today