ST_DumpRings — 返回一组 geometry_dump
多边形的外环和内环的行。
geometry_dump[] ST_DumpRings(
geometry a_polygon)
;
提取多边形环的集合返回函数(SRF)。它返回一组 geometry_dump 行,每个行包含一个几何图形( 几何图形
字段)和一个整数数组( 路径
字段)。
这个 几何图形
该字段将每个环包含为一个多边形。这个 路径
字段是包含多边形环索引的长度为1的整数数组。外环(壳)的索引为0。内环(孔)的折射率为1或更高。
这仅适用于多边形几何体。它不适用于多聚合一 |
提供:PostGIS 1.1.3。需要PostgreSQL 7.3或更高版本。
This function supports 3d and will not drop the z-index.
查询的一般形式。
SELECT polyTable.field1, polyTable.field1, (ST_DumpRings(polyTable.geom)).geom As geom FROM polyTable;
只有一个洞的多边形。
SELECT path, ST_AsEWKT(geom) As geom FROM ST_DumpRings( ST_GeomFromEWKT('POLYGON((-8149064 5133092 1,-8149064 5132986 1,-8148996 5132839 1,-8148972 5132767 1,-8148958 5132508 1,-8148941 5132466 1,-8148924 5132394 1, -8148903 5132210 1,-8148930 5131967 1,-8148992 5131978 1,-8149237 5132093 1,-8149404 5132211 1,-8149647 5132310 1,-8149757 5132394 1, -8150305 5132788 1,-8149064 5133092 1), (-8149362 5132394 1,-8149446 5132501 1,-8149548 5132597 1,-8149695 5132675 1,-8149362 5132394 1))') ) as foo; path | geom ---------------------------------------------------------------------------------------------------------------- {0} | POLYGON((-8149064 5133092 1,-8149064 5132986 1,-8148996 5132839 1,-8148972 5132767 1,-8148958 5132508 1, | -8148941 5132466 1,-8148924 5132394 1, | -8148903 5132210 1,-8148930 5131967 1, | -8148992 5131978 1,-8149237 5132093 1, | -8149404 5132211 1,-8149647 5132310 1,-8149757 5132394 1,-8150305 5132788 1,-8149064 5133092 1)) {1} | POLYGON((-8149362 5132394 1,-8149446 5132501 1, | -8149548 5132597 1,-8149695 5132675 1,-8149362 5132394 1))