Returns the text representation of an ST_Geometry value.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsText()
Assuming that the st_geometry_astext_format option has the value 'WKT', the following returns the result Point ZM (1 2 3 4). The ST_AsText method is implicitly invoked when converting geometries to VARCHAR or NVARCHAR types.See st_geometry_astext_format option.
SELECT CAST( NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ) as long varchar)
The following returns the result Point (1 2). The Z and M values are not output because they are not supported in version 1.1.0 of the OGC specification for WKT.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsText('WKT(Version=1.1)')
The following returns the result SRID=4326;Point ZM (1 2 3 4). The SRID is included in the result as a prefix.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsText('EWKT')
The following example returns the result <Point srsName="EPSG:4326"><pos>1 2 3 4</pos></Point>.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsText('GML')
The following returns '{"type":"Point", "coordinates":[1,2]} '.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsText('GeoJSON')
The following returns a complete SVG document with polygons filled with random colors.
SELECT NEW ST_Polygon( 'Polygon(( 0 0, 0 20, 60 10, 0 0 ))' ) .ST_AsText( 'SVG' )
SQL/MM (ISO/IEC 13249-3: 2006) 5.1.35