- Categories:
ST_ GEOMETRYFROMWKT¶
Parses a WKT (well-known text) or EWKT (extended well-known text) input and returns a value of type GEOMETRY.
- Aliases:
ST_GEOMFROMWKT , ST_GEOMETRYFROMEWKT , ST_GEOMFROMEWKT , ST_GEOMETRYFROMTEXT , ST_GEOMFROMTEXT
- See also:
Syntax¶
Arguments¶
Required:
varchar_expressionThe argument must be a string expression in WKT or EWKT that represents a valid geospatial object.
Optional:
sridThe integer value of the SRID to use.
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 GEOMETRY.
Usage notes¶
- Issues an error if the input cannot be parsed as WKT or EWKT.
- For WKT input, if the
sridargument is not specified, the resulting GEOMETRY object has the SRID set to 0.
Examples¶
The following example returns the GEOMETRY object for a geospatial object described in EWKT format:
The following example returns the GEOMETRY object for a geospatial object with a Z coordinate described in EWKT format:
In the next example, the input is in WKT format, and the function call specifies the SRID to use: