Suppose you have a polygon with an inner ring representing a hole, and inside that hole is another inner ring (an "island"):
The above shape can be generated using:
SELECT
ST_MakePolygon(
ST_ExteriorRing(ST_Buffer(center, 10, 10)),
ARRAY[
ST_ExteriorRing(ST_Buffer(center, 6, 6)),
ST_ExteriorRing(ST_Buffer(center, 3, 3))
]
) AS geom
FROM ST_MakePoint(0, 0) AS center;
While this can be represented as a single polygon, I have a requirement to convert this into multiple polygons. I am working with a library that supports polygons with holes, but does not support "islands" inside those holes - thus, I need to be able to extract those islands into separate polygons. And in case those islands also have holes that have even more "inner" islands - I need to be able to be able to extract those inner islands as well, such that no polygon in the result set contains "islands". Multiple holes (inner rings) are allowed - just no islands inside any of those holes (no inner ring wholly contained inside another inner ring).
How can I achieve this using PostGIS?
Also just to expand my knowledge... is there a more precise terminology I can use instead of "island"? I'm aware of "inner ring", but an inner ring can represent either a hole, or an "island" inside a hole. Just wondering if there is a more specific term for when an inner ring represents an island vs a hole.