# [postgis-users] Donut-Polygon

Thu Feb 5 15:57:14 PST 2009

```Or, if you want to filter by area (POLYGON and MULTIPOLYGON), see this: http://www.spatialdbadvisor.com/postgis_tips_tricks/92/filtering-rings-in-polygon-postgis
regards
Simon
On Fri, 06 Feb 2009 05:29:15 +1100, Kevin Neufeld <kneufeld at refractions.net> wrote:

> Use ST_DumpRings to extract the rings, then exclude the ones you don't want and then rebuild your polygon.
> http://postgis.refractions.net/documentation/manual-svn/ST_DumpRings.html
>
> ie.
> -- A polygon with 6 inner rings, we exclude all but rings 3 and 5
> SELECT ST_AsText(ST_BuildArea(ST_Collect(geom))) AS the_geom
> FROM (SELECT (ST_DumpRings(
>      'POLYGON (( 0 0, 0 7, 10 7, 10 0, 0 0 ),
>                ( 1 4, 3 4, 3 6, 1 6, 1 4 ),
>                ( 4 4, 6 4, 6 6, 4 6, 4 4 ),
>                ( 7 4, 9 4, 9 6, 7 6, 7 4 ),
>                ( 1 1, 3 1, 3 3, 1 3, 1 1 ),
>                ( 4 1, 6 1, 6 3, 4 3, 4 1 ),
>                ( 7 1, 9 1, 9 3, 7 3, 7 1 )
>                )'::geometry)).*) AS foo
> WHERE NOT ( ARRAY[1,2,4,6] @> path );
>
>                                     the_geom
> ------------------------------------------------------------------------------
>   POLYGON((0 0,0 7,10 7,10 0,0 0),(7 4,9 4,9 6,7 6,7 4),(4 1,6 1,6 3,4 3,4 1))
> (1 row)
>
> Cheers,
> Kevin
>
> Albert Krueger wrote:
>> Hi at all,
>>
>> I have a Donut-Polygon with a number of Innerrings. Now I would like to
>> delete some Innerrings. For Example I have a polygon with five
>> Innerrings. ButI want to delete the second and the fourth Innerring. Has
>> anyone an idea how I can get a polygon with only three Innerrings
>> (1,3,5) then?
>>
>> Thank you!
>>
>> Best regards
>>
>> Albert
>>
>>
>> _________________________________
>> LOVE at LYCOS ist jetzt ganz neu - melde dich kostenlos an, lerne neue
>> Leute kennen und finde deinen Flirt!
>> Jetzt flirten!
>> <http://bc.lycos-europe.net/lnl/bc.php?loveatlycos_promo_mailsig|http://love.lycos.de/start.action?utm_campaign=mp&utm_source=mailsig>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>

--
SpatialDB Advice and Design, Solutions Architecture and Programming,
Oracle Database 10g Administrator Certified Associate; Oracle Database 10g SQL Certified Professional
Oracle Spatial, SQL Server, PostGIS, MySQL, ArcSDE, Manifold GIS, FME, Radius Topology and Studio Specialist.
39 Cliff View Drive, Allens Rivulet, 7150, Tasmania, Australia.