5. Geospatial Functions : AsText
 
Share this page                  
AsText
ASTEXT(g Geometry)
Alias: ST_ASTEXT
Returns g in Well Known Text (WKT).
Result type: string
Example:
SELECT ASTEXT(LINEFROMTEXT('LINESTRING(0 0, 2 2, 0 4, 6 6, 0 8, 10 10)'));
-------------------------------------------
col1
-------------------------------------------
LINESTRING (0 0, 2 2, 0 4, 6 6, 0 8, 10 10)
-------------------------------------------
Note:  The ASTEXT function returns a long varchar with the coordinates. The ASTEXT examples should not be run in ISQL (the forms-based Terminal Monitor) because this application cannot display long data types and will return an "Unbounded data" error. Run the examples in SQL (the line-based Terminal Monitor).