ST_GeomFromText
Signatures
GEOMETRY ST_GeomFromText(VARCHAR wkt);
GEOMETRY ST_GeomFromText(VARCHAR wkt, INT srid);
Description
Converts the Well Known Text wkt
into a Geometry with spatial reference id
srid
. The default value of srid
is 0.
Note: If wkt
specifies a Geometry with z-coordinates, they will be
conserved in reality but suppressed when visualizing the Geometry as WKT.
Implements the OpenGIS Simple Features Implementation Specification for SQL version 1.2.1.
Examples
SELECT ST_GeomFromText('POINT(2 3)', 27572);
-- Answer: POINT(2 3)
SELECT ST_SRID(ST_GeomFromText('LINESTRING(1 3, 1 1, 2 1)'));
-- Answer: 0
SELECT ST_GeomFromText('POLYGON((0 0 -1, 2 0 2, 2 1 3, 0 0 -1))');
-- Answer: POLYGON((0 0, 2 0, 2 1, 0 0))