-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 > Would probably be more efficiently done with > > SELECT gid, ST_Collect(ScrubPolygon(geom)) As scrubbedgeom > FROM > (SELECT gid, (ST_Dump(the_geom)).geom > FROM tabletoscrub) As foo > GROUP By gid ; > > The reason being is that ST_GeometryN is quite inefficient when dealing > with > large numbers of geometries. So if you plan to dump out all geometries > use > ST_Dump instead.
Thank you, Regina. That cleaned up the weird nested collections that were being created and also simplified the function to just this: create function ScrubMultiPolygon(input geometry) returns geometry as $$ begin return (select ST_Collect(ScrubPolygon(geom)) from (select (ST_Dump(input)).geom) as x); end; $$ LANGUAGE plpgsql; > Also would be nice if you posted this to the wiki when you are done. Sure thing. I'm almost there. The function works beautifully except on a few geometries. These geometries produce messages like the following when I call ST_IsValid: NOTICE: Nested shells at or near point -76.554 38.8815 I'm not sure what "nested shell" means. At first thought it says to me that one external polygon is contained inside another external polygon, but isn't that legal? -----BEGIN PGP SIGNATURE----- Version: PGP Universal 2.8.3 Charset: us-ascii wsBVAwUBSKMRFR6WPRoYuvd0AQhDfAf8CjiGu2gup9dSdmqqrFhlffMm7/k1OGg4 Y0wutlOJZO9jpCfTEVv7BvcAi2k2j7y6UFI165qHrCIAAAmhv3Qt02T4m5qY0lqV bMf38uYXt6dLRiWTKTdfqGMZ8OSqctKmOTzxwQxOkDmIOOS7mmaZ9hix8yAjuZU1 2QFaN9gyfmhA4Tn2mbLmnZicPmnDiXeMH1k7bPgwUEUp3GzNW9PngOciQiQPa5vc mCo1P1zq/pN0lFinf8UZBMzDAautn08upMCA3ckQInJGEhmDKxpb3LqQVkx3GZXl IIWzgF59g6Pw+emUd5nGzkTZ2HEa7xl5I4Cs/8TJh0N8uJCgQYo5gQ== =dJDS -----END PGP SIGNATURE----- _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users