ST_GeomFromText
Convert a geometry from its Well-Known Text (WKT) representation.
ST_GeomFromWKT is exactly the same as ST_WKTToSQL. ST_WKTToSQL does the reverse of ST_AsText.
Syntax
ST_GeomFromText(wktgeo[, srid[, computeMBR]]);
- wktgeo
- The input geometry in WKT format.
Type: VARCHAR(ANY)
- srid
- The spatial reference system identifier.
Type: INT4
Default: 4326
- computeMBR
-
Whether to calculate the minimum bounding rectangle (MBR) of the input geometry.
Type: BOOL
Default: TRUE
Returns
A value of type ST_GEOMETRY(ANY) that contains a geometry.
Examples
SELECT inza..ST_AsText(inza..ST_GeomFromText('POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))'));
ST_ASTEXT
-----------------------------------------------
POLYGON ((10 10, 20 15, 20 20, 10 20, 10 10))
(1 row)
SELECT inza..ST_AsText(inza..ST_GeomFromText('POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))', 4326));
ST_ASTEXT
-----------------------------------------------
POLYGON ((10 10, 20 15, 20 20, 10 20, 10 10))
(1 row)
SELECT inza..ST_AsText(inza..ST_GeomFromText('POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))', 4326, true));
ST_ASTEXT
---------
POLYGON ((10 10, 20 15, 20 20, 10 20, 10 10))
(1 row)