[postgis-users] Removing holes from polygons

Paragon Corporation lr at pcorp.us
Tue Nov 3 12:53:28 PST 2009


You probably want to do a ST_Dump as well if you are talking about
Multipolygons and also exterior ring returns the linestring -- need to use
ST_MakePolygon to turn it back into a polygon

SELECT s.gid, ST_Collect(ST_MakePolygon(s.the_geom)) As the_geom
FROM (SELECT gid, ST_ExteriorRing((ST_Dump(the_geom)).geom) As the_geom
 FROM sometable )  As s
 GROUP BY gid; 

Leo

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of strk
Sent: Tuesday, November 03, 2009 3:15 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Removing holes from polygons

On Tue, Nov 03, 2009 at 02:23:28PM -0500, Akhil Jaggarwal wrote:

> Any tips or hints on a query which removes all the inner holes from a 
> polygon and returns and keeps the geometry of the largest one intact?

SELECT ST_ExteriorRing(geometry)  ...

--strk; 

 Free GIS & Flash consultant/developer      ()  ASCII Ribbon Campaign
 http://foo.keybit.net/~strk/services.html  /\  Keep it simple! 
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users






More information about the postgis-users mailing list