ST_AsText
Name
ST_AsText — Return the Well-Known Text (WKT) representation of the geometry/geography without SRID metadata.
Synopsis
    
     text
     
      ST_AsText
     
     (
    
    geometry
    
     g1
    
    
     )
    
    ;
   
    
     text
     
      ST_AsText
     
     (
    
    geometry
    
     g1
    
    , integer
    
     maxdecimaldigits = 15
    
    
     )
    
    ;
   
    
     text
     
      ST_AsText
     
     (
    
    geography
    
     g1
    
    
     )
    
    ;
   
    
     text
     
      ST_AsText
     
     (
    
    geography
    
     g1
    
    , integer
    
     maxdecimaldigits = 15
    
    
     )
    
    ;
   
Description
   Returns the OGC
   
    Well-Known Text
   
   (WKT) representation of the geometry/geography.
            The optional
   
    
     maxdecimaldigits
    
   
   argument may be used to limit the number
			of digits after the decimal point in output ordinates (defaults to 15).
  
To perform the inverse conversion of WKT representation to PostGIS geometry use ST_GeomFromText .
       
      | 
     |
| 
       The standard OGC WKT representation does not include the SRID. To include the SRID as part of the output representation, use the non-standard PostGIS function ST_AsEWKT  | 
    
       
      | 
     |
| 
       
       The textual representation of numbers in WKT may not maintain full floating-point precision.
            To ensure full accuracy for data storage or transport it is best to use
       
        Well-Known Binary
       
       (WKB) format
            (see
       
        ST_AsBinary
       
       and
       
          | 
    
       
      | 
     |
| 
       
       Using the
       
          | 
    
Availability: 1.5 - support for geography was introduced.
Enhanced: 2.5 - optional parameter precision introduced.
   
    
   
   This method implements the
   
    OGC Simple Features
            Implementation Specification for SQL 1.1.
   
  
s2.1.1.1
   
    
   
   This method implements the SQL/MM specification.
  
SQL-MM 3: 5.1.25
   
    
   
   This method supports Circular Strings and Curves.
  
Examples
SELECT ST_AsText('01030000000100000005000000000000000000
000000000000000000000000000000000000000000000000
F03F000000000000F03F000000000000F03F000000000000F03
F000000000000000000000000000000000000000000000000');
    st_astext
--------------------------------
 POLYGON((0 0,0 1,1 1,1 0,0 0))
  Full precision output is the default.
SELECT ST_AsText('POINT(111.1111111 1.1111111)'));
    st_astext
------------------------------
 POINT(111.1111111 1.1111111)
  
   The
   
    
     maxdecimaldigits
    
   
   argument can be used to limit output precision.
  
SELECT ST_AsText('POINT(111.1111111 1.1111111)'), 2);
    st_astext
--------------------
 POINT(111.11 1.11)