Re: [postgis-users] Merge rectangles
You don't need to do array unless you have a reason for that LIMIT. ST_Union is an overloaded function: One version is an aggregate and one takes an array of geometries. So below is a bit shorter to write: SELECT ST_Union(poly) FROM portal.catalog WHERE cat.type = 'CADRG'; -Original Message- From: postgis-users-boun...@postgis.refractions.net [mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of DrYSG Sent: Wednesday, August 15, 2012 2:39 PM To: postgis-users@postgis.refractions.net Subject: [postgis-users] Merge rectangles In the table portal.catalog column poly is a geometry (always a rectangle, with datum EPSG 4326) column type is a text field. I want to find all the records who have a type of CADRG and merge the polygons into the simplest shape that covers all the items in the array (I.e. if they form a square with a hole, then I want that, if it has to be a multipolygon, so be it). Is this the correct way to do that? SELECT ST_AsText(ST_Union( ARRAY( SELECT poly FROM portal.catalog as cat WHERE cat.type='CADRG' LIMIT 10 ) ) ) -- View this message in context: http://postgis.17.n6.nabble.com/Merge-rectangles-tp4999357.html Sent from the PostGIS - User mailing list archive at Nabble.com. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Merge rectangles
Sorry, the LIMIT was for testing purposes (since there might be a few hundred to thousand) polygons in the return set. What I am hoping is that the UNION will simplify the resulting polygon as much as possible (just the ourside boundary). Is that correct? (given that there are no holes). -- View this message in context: http://postgis.17.n6.nabble.com/Merge-rectangles-tp4999357p4999365.html Sent from the PostGIS - User mailing list archive at Nabble.com. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Merge rectangles
Correct it will dissolve overlapping regions, though you still may end up with multipolygons if you have islands of polygons. -Original Message- From: postgis-users-boun...@postgis.refractions.net [mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of DrYSG Sent: Thursday, August 16, 2012 2:59 PM To: postgis-users@postgis.refractions.net Subject: Re: [postgis-users] Merge rectangles Sorry, the LIMIT was for testing purposes (since there might be a few hundred to thousand) polygons in the return set. What I am hoping is that the UNION will simplify the resulting polygon as much as possible (just the ourside boundary). Is that correct? (given that there are no holes). -- View this message in context: http://postgis.17.n6.nabble.com/Merge-rectangles-tp4999357p4999365.html Sent from the PostGIS - User mailing list archive at Nabble.com. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users