OPessoa Blog

Finding Hole in Multipolygon

Posted on 2015-01-01 00:00:00


Regina `s algorithm
SELECT st_AsText(st_interiorringn(st_GeometryN(the_geom,gn.n),st_numinteriorrings(st_GeometryN(the_geom,gn.n)))) AS geometryOfHole

FROM ruas_draw,

     generate_series(1, 1000) gn(n)

WHERE st_NumGeometries(the_geom) >= gn.n

  AND st_numinteriorrings(st_GeometryN(the_geom,gn.n)) > 0