ST_GeographyFromText
Converts a Well-Known Text (WKT) string into its corresponding GEOGRAPHY object. Use this function to convert a WKT string into the format expected by the Vertica Place functions.
A GEOGRAPHY object is a spatial object with coordinates (longitude, latitude) defined on the surface of the earth. Coordinates are expressed in degrees (longitude, latitude) from reference planes dividing the earth.
The maximum size of a GEOGRAPHY object is 10 MB. If you pass a WKT to ST_GeographyFromText, the result is a spatial object whose size is greater than 10 MB, ST_GeographyFromText returns an error.
The Open Geospatial Consortium (OGC) defines the format of a WKT string in Section 7 in the Simple Feature Access Part 1 - Common Architecture specification.
Behavior type
ImmutableSyntax
ST_GeographyFromText( wkt [ USING PARAMETERS ignore_errors={'y'|'n'} ] )
Arguments
- wkt
- Well-Known Text (WKT) string of a GEOGRAPHY object, type LONG VARCHAR
- ignore_errors
- (Optional) ST_GeographyFromText returns the following, based on the parameters supplied:
- 
NULL—If wktis invalid andignore_errors='y'.
- 
Error—If wktis invalid andignore_errors='n'or is unspecified.
 
- 
Returns
GEOGRAPHY
Supported data types
| Data Type | GEOGRAPHY (Perfect Sphere) | GEOGRAPHY (WGS84) | 
|---|---|---|
| Point | Yes | Yes | 
| Multipoint | Yes | Yes | 
| Linestring | Yes | Yes | 
| Multilinestring | Yes | Yes | 
| Polygon | Yes | Yes | 
| Multipolygon | Yes | Yes | 
| GeometryCollection | No | No | 
Examples
The following example shows how to use ST_GeographyFromText.
Convert WKT into a GEOGRAPHY object:
=> CREATE TABLE wkt_ex (g GEOGRAPHY);
 CREATE TABLE
=> INSERT INTO wkt_ex VALUES(ST_GeographyFromText('POLYGON((1 2,3 4,2 3,1 2))'));
 OUTPUT
--------
      1
(1 row)