This topic describes the ST_PolygonFromText function. This function constructs a polygon object by using a Well-Known Text (WKT) string and a spatial reference identifier (SRID).


geometry  ST_PolygonFromText(text  wKT);
geometry  ST_PolygonFromText(text  wKT , integer  srid);


Parameter Description
wKT The WKT string that you want to specify.
srid The spatial reference identifier (SRID) of the polygon object.


  • If you do not specify an SRID, the SRID defaults to 0.
  • If the WKT string that you specify does not represent a polygon object, this function returns NULL.
  • If you are sure that the WKT string that you want to specify represents a polygon object, we recommend that you use the ST_GeomFromText function, which can construct polygon objects at higher speeds because no unnecessary checks are required.


SELECT ST_AsEWKT(ST_PolygonFromText('POLYGON((1 2,3 4,5 6,1 2))',4326));
 SRID=4326;POLYGON((1 2,3 4,5 6,1 2))
(1 row)