The ST_PolyFromText() function

The ST_PolyFromText() function takes a well-known text representation of type ST_Polygon and a spatial reference ID and returns an ST_Polygon.

Syntax

ST_PolyFromText(wkt lvarchar, SRID integer)

Return type

ST_Polygon

Example

The polygon_test table is created with the single polygon column:
CREATE TABLE polygon_test (pl1 ST_Polygon);
The following INSERT statement inserts a polygon into the pl1 polygon column using the ST_PolyFromText() function:
INSERT INTO polygon_test VALUES(
    ST_PolyFromText('polygon((10.01 20.03,10.52 40.11,30.29
41.56,31.78 10.74,10.01 20.03))',1000)
);