- Categories:
ST_ GEOGRAPHYFROMWKT¶
Parses a WKT (well-known text) or EWKT (extended well-known text) input and returns a value of type GEOGRAPHY.
- Aliases:
ST_GEOGFROMWKT , ST_GEOGRAPHYFROMEWKT , ST_GEOGFROMEWKT , ST_GEOGRAPHYFROMTEXT , ST_GEOGFROMTEXT
- See also:
Syntax¶
Arguments¶
Required:
varchar_expressionThe argument must be a string expression in WKT or EWKT that represents a valid geospatial object.
Optional:
allow_invalidIf TRUE, specifies that the function returns a GEOGRAPHY or GEOMETRY object, even when the input shape isn’t valid and can’t be repaired. For more information, see Specifying how invalid geospatial shapes are handled.
Returns¶
The function returns a value of type GEOGRAPHY.
Usage notes¶
- Issues an error if the input cannot be parsed as WKT or EWKT.
- Issues an error if the input format is EWKT and the SRID is not 4326. See the note on EWKT and EWKB handling.
- For the coordinates in WKT, EWKT, and GeoJSON, longitude appears before latitude (for example,
POINT(lon lat)).
Examples¶
The following example returns the GEOGRAPHY object for a geospatial object described in WKT format:
The following example returns the GEOGRAPHY object for a geospatial object with a Z coordinate described in WKT format:
The following example returns the GEOGRAPHY object for a geospatial object described in EWKT format: