ST_Polygon — 从具有指定SRID的线串创建多边形。
geometry ST_Polygon(
geometry lineString, integer srid)
;
返回从给定线串构建的面,并从 srid
。
ST_Polygon类似于 ST_MakePolygon 变体1,增加了设置SRID。
要创建带有孔的多边形,请使用 ST_MakePolygon 变体2,然后 ST_SetSRID 。
![]() | |
此函数不接受多行字符串。使用 ST_LineMerge 要生成线条,或 ST_Dump 若要提取线条字符串,请执行以下操作。 |
This method implements the OGC Simple Features
Implementation Specification for SQL 1.1.
This method implements the SQL/MM specification. SQL-MM 3:8.3.2
This function supports 3d and will not drop the z-index.
创建一个二维多边形。
SELECT ST_AsText( ST_Polygon('LINESTRING(75 29, 77 29, 77 29, 75 29)'::geometry, 4326) ); -- result -- POLYGON((75 29, 77 29, 77 29, 75 29))
创建3D多边形。
SELECT ST_AsEWKT( ST_Polygon( ST_GeomFromEWKT('LINESTRING(75 29 1, 77 29 2, 77 29 3, 75 29 1)'), 4326) ); -- result -- SRID=4326;POLYGON((75 29 1, 77 29 2, 77 29 3, 75 29 1))