[postgis-users] Interior rings

Paul Ramsey pramsey at cleverelephant.ca
Tue Aug 13 08:16:24 PDT 2019


You’re going to want to chain a ST_DumpRings (turn polygons to rings) to an ST_Dump (turn mutlis to singletons) and then look at the dump ring composite type and omit ring 1 from the relation…

Something like:


WITH 
poly AS (
  SELECT 'MULTIPOLYGON(((0 0, 0 10, 10 10, 10 0, 0 0), (4 4, 4 5, 5 5, 5 4, 4 4)))'::geometry AS g
  ),
rings AS (
  SELECT (ST_DumpRings((ST_Dump(g)).geom)).* FROM poly
  )
SELECT * FROM rings
WHERE path != '{0}';


> On Aug 13, 2019, at 7:39 AM, <paul.malm at lfv.se> <paul.malm at lfv.se> wrote:
> 
> Hi, I would like to create a table with all the interior rings (islands) from a table with multipolygons lakes.
> I’ve only come this far:
> CREATE TABLE "islands" AS SELECT  (ST_InteriorRingn(the_geom, 2)).geometry AS the_geom FROM public."lakes";
> But this is only collecting the first island in each lake.
> Thankful for any suggestions.
> /Paul 
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org <mailto:postgis-users at lists.osgeo.org>
> https://lists.osgeo.org/mailman/listinfo/postgis-users <https://lists.osgeo.org/mailman/listinfo/postgis-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190813/b316787f/attachment.html>


More information about the postgis-users mailing list