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¶
ST_GEOMETRYFROMWKT( <varchar_expression> )
ST_GEOMFROMWKT( <varchar_expression> )
ST_GEOMETRYFROMEWKT( <varchar_expression> )
ST_GEOMFROMEWKT( <varchar_expression> )
ST_GEOMETRYFROMTEXT( <varchar_expression> )
ST_GEOMFROMTEXT( <varchar_expression> )
Arguments¶
varchar_expression
The argument must be a string expression in WKT or EWKT that represents a valid geospatial object.
Usage Notes¶
Issues an error if the input cannot be parsed as WKT or EWKT.
For WKT input, the resulting GEOMETRY object has SRID set to 0.
To change the SRID of a GEOMETRY object, pass the GEOMETRY object to ST_SETSRID, specifying the SRID that you want to set. ST_SETSRID returns the GEOMETRY object that has the specified SRID.
Examples¶
The following example returns the GEOMETRY object for a geospatial object described in EWKT format:
-- Set the output format to EWKT ALTER SESSION SET GEOMETRY_OUTPUT_FORMAT='EWKT'; SELECT ST_GEOMETRYFROMEWKT('SRID=32633;POINT(389866.35 5819003.03)');+---------------------------------------------------------------+ | ST_GEOMETRYFROMEWKT('SRID=32633;POINT(389866.35 5819003.03)') | |---------------------------------------------------------------| | SRID=32633;POINT(389866.35 5819003.03) | +---------------------------------------------------------------+
In the next example, the input is in WKT format, which does not specify the SRID:
-- Set the output format to WKT ALTER SESSION SET GEOMETRY_OUTPUT_FORMAT='EWKT'; SELECT ST_GEOMETRYFROMWKT('POINT(389866.35 5819003.03)');+----------------------------------------------------+ | ST_GEOMETRYFROMWKT('POINT(389866.35 5819003.03)') | |----------------------------------------------------| | SRID=0;POINT(389866.35 5819003.03) | +----------------------------------------------------+