ST_WKTToSQL

Create a geometry that corresponds to a Well-Known Text (WKT) geometry.

ST_WKTToSQL is exactly the same as ST_GeomFromWKT, and does the reverse of ST_AsText.

Syntax

ST_WKTToSQL(wktgeo[, srid[, computeMBR[, skiptest]]]);
wkt
The input geometry, in WKT representation.

Type: VARCHAR(ANY)

srid
The Spatial Reference System Identifier. Type:

Type: INT4

Default: 4326

computeMBR
Whether the MBR should be computed.

Type: BOOL

Default: TRUE

skiptest
Whether the simple geometry test should be skipped.

Type: BOOL

Default: FALSE

Returns

A value of type VARCHAR(ANY) that contains the output geometry.

Examples

SELECT inza..ST_AsText(inza..ST_WKTToSQL('POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))'));
 
ST_ASTEXT
-----------
POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))
(1 row)
 
SELECT inza..ST_AsText(inza..ST_WKTToSQL('POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))', 4326));
 
ST_ASTEXT
----------
POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))
(1 row)
 
SELECT inza..ST_AsText(inza..ST_WKTToSQL('POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))', 4326, true));
 
ST_ASTEXT
-----------
POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))
(1 row)