Removing holes from polygons

View: New views
2 Messages — Rating Filter:   Alert me  

Removing holes from polygons

by Akhil Jaggarwal-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Paragon Corp and strk.

I've tried both the queries but I'm getting back the same multipolygon
which I had to explode to do subsetting.

The exploded table had 416 geometries (holes + polygons) as compared
to the original table with multipolygons which has 234 geometries.

I've also tried union to get the bigger of the contained geometries
but that doesn't seem to work either.


Regards
AKhil
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Removing holes from polygons

by Paragon Corporation-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

AkHil,

It could be you don't have holes at all and what you have are invalid
multipolygons that intersect each other.  On screen they may appear to be
holes because one polygon is within another.

One way to turn the overlapping/inner polygons into holes is to do a
ST_BuildArea on them.
http://www.postgis.org/documentation/manual-svn/ST_BuildArea.html

So
1) Take your original set of data and do a

SELECT gid, ST_BuildArea(the_geom) As the_geom
INTO newtable
FROM origtable

2) Then reapply what we mentioned ST_ExteriorRing to get the holes out.

Hope that helps,
Regina

-----Original Message-----
From: postgis-users-bounces@...
[mailto:postgis-users-bounces@...] On Behalf Of Akhil
Jaggarwal
Sent: Tuesday, November 03, 2009 4:54 PM
To: postgis-users@...
Subject: [postgis-users] Removing holes from polygons

Thanks Paragon Corp and strk.

I've tried both the queries but I'm getting back the same multipolygon which
I had to explode to do subsetting.

The exploded table had 416 geometries (holes + polygons) as compared to the
original table with multipolygons which has 234 geometries.

I've also tried union to get the bigger of the contained geometries but that
doesn't seem to work either.


Regards
AKhil
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users



_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users