st_astext function
Applies to: Databricks SQL
Databricks Runtime 17.1 and above
Preview
This feature is in Public Preview.
nota
This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types.
Returns the input GEOGRAPHY or GEOMETRY value in WKT format.
Syntax
st_astext ( geoExpr )
Arguments
geoExpr: AGEOGRAPHYorGEOMETRYvalue.
Returns
A value of type STRING.
The returned value is the WKT description of the input GEOGRAPHY or GEOMETRY value.
The function returns NULL if the input is NULL.
Examples
SQL
-- Export a 3DZ Cartesian point, given in GeoJSON format, in WKT format.
> SELECT st_astext(to_geometry('{"type":"Point","coordinates":[2.718281828,3.141592653,100]}'));
POINT Z (2.718281828 3.141592653 100)
-- Export a 3DZ geographic point, given in GeoJSON format, in WKT format.
> SELECT st_astext(to_geography('{"type":"Point","coordinates":[2.718281828,3.141592653,100]}'));
POINT Z (2.718281828 3.141592653 100)
Related functions
st_asbinaryfunctionst_asewkbfunctionst_asewktfunctionst_asgeojsonfunctionst_aswkbfunctionst_aswktfunctionst_geogfromgeojsonfunctionst_geogfromtextfunctionst_geogfromwkbfunctionst_geogfromwktfunctionst_geomfromewkbfunctionst_geomfromgeojsonfunctionst_geomfromtextfunctionst_geomfromwkbfunctionst_geomfromwktfunctionto_geographyfunctionto_geometryfunctiontry_to_geographyfunctiontry_to_geometryfunction