ST_Polygonize — 计算由一组几何图形的线条形成的多边形集合。
geometry ST_Polygonize(
geometry set geomfield)
;
geometry ST_Polygonize(
geometry[] geom_array)
;
创建包含由一组几何图形的组成线条形成的多边形的GeometryCollection。必须正确标记输入线条,此功能才能正常工作。
![]() | |
要确保输入是完全节点的,请使用 ST_Node 在多边形化之前的输入几何体上。 |
![]() | |
GeometryCollection通常很难用第三方工具来处理。使用 ST_Dump 若要将多边形化结果转化为单独的多边形,请执行以下操作。 |
由GEOS模块执行。
可用性:1.0.0RC1
SELECT ST_AsEWKT(ST_Polygonize(geom_4269)) As geomtextrep FROM (SELECT geom_4269 FROM ma.suffolk_edges ORDER BY tlid LIMIT 45) As foo; geomtextrep ------------------------------------- SRID=4269;GEOMETRYCOLLECTION(POLYGON((-71.040878 42.285678,-71.040943 42.2856,-71.04096 42.285752,-71.040878 42.285678)), POLYGON((-71.17166 42.353675,-71.172026 42.354044,-71.17239 42.354358,-71.171794 42.354971,-71.170511 42.354855, -71.17112 42.354238,-71.17166 42.353675))) (1 row) --Use ST_Dump to dump out the polygonize geoms into individual polygons SELECT ST_AsEWKT((ST_Dump(foofoo.polycoll)).geom) As geomtextrep FROM (SELECT ST_Polygonize(geom_4269) As polycoll FROM (SELECT geom_4269 FROM ma.suffolk_edges ORDER BY tlid LIMIT 45) As foo) As foofoo; geomtextrep ------------------------ SRID=4269;POLYGON((-71.040878 42.285678,-71.040943 42.2856,-71.04096 42.285752, -71.040878 42.285678)) SRID=4269;POLYGON((-71.17166 42.353675,-71.172026 42.354044,-71.17239 42.354358 ,-71.171794 42.354971,-71.170511 42.354855,-71.17112 42.354238,-71.17166 42.353675)) (2 rows)