ST_ASTEXT()
All functions > GEOSPATIAL > ST_ASTEXT()
Returns the WKT (Well Known Text) representation of a geometry or geography.
Signatures
Geometry to WKT
Returns: WKT string
ST_ASTEXT(geo: T) → VARCHAR sql
| Parameter | Type | Required | Description |
|---|---|---|---|
geo | T | Yes | Geometry or geography value |
With:
T: Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY | GEOG_POINT | GEOG_LINESTRING | GEOG_POLYGON | GEOG_MULTIPOINT | GEOG_MULTILINESTRING | GEOG_MULTIPOLYGON | GEOG_MULTIANY
Signature notes:
- Accepts any sub kind (Point, LineString, Polygon, Multi*, GeometryCollection)
- Works on both GEOMETRY and GEOGRAPHY values
- Returns NULL if the input is NULL
Examples
Geometry
FeatureQL
SELECT
f1 := ST_ASTEXT(ST_GEOMPOINT(1.0, 2.0)) -- Point to WKT
;Result
| f1 VARCHAR |
|---|
| POINT (1 2) |
Geography
FeatureQL
SELECT
f1 := ST_ASTEXT(ST_GEOGPOINT(-122.4194, 37.7749)) -- Geography point to WKT
;Result
| f1 VARCHAR |
|---|
| POINT (-122.4194 37.7749) |
On this page