PostGIS

ST_PolygonFromText

Prev

8.8.1. Well-Known Text (WKT)

Next

Name

ST_PolygonFromText — Makes a Geometry from WKT with the given SRID. If SRID is not given, it defaults to 0.

Synopsis

geometry +`*`+ST_PolygonFromText*(`text `WKT`)`;

geometry +`*`+ST_PolygonFromText*(`text `WKT, integer srid`)`;

Description

Makes a Geometry from WKT with the given SRID. If SRID is not given, it defaults to 0. Returns null if WKT is not a polygon.

OGC SPEC 3.2.6.2 - option SRID is from the conformance suite

Note

If you are absolutely sure all your WKT geometries are polygons, don’t use this function. It is slower than ST_GeomFromText since it adds an additional validation step.

check This method implements the SQL/MM specification. SQL-MM 3: 8.3.6

Examples

SELECT ST_PolygonFromText('POLYGON((-71.1776585052917 42.3902909739571,-71.1776820268866 42.3903701743239,
-71.1776063012595 42.3903825660754,-71.1775826583081 42.3903033653531,-71.1776585052917 42.3902909739571))');
st_polygonfromtext
------------------
010300000001000000050000006...


SELECT ST_PolygonFromText('POINT(1 2)') IS NULL as point_is_notpoly;

point_is_not_poly
----------
t

See Also

Prev

Up

Next

ST_PointFromText

Home

ST_WKTToSQL