[postgis-users] Collecting Polygons

Kevin Neufeld kneufeld at refractions.net
Fri Jun 27 11:19:59 PDT 2008


Hi Lee,

If you want to merge several polygons together, dissolving them into a 
single polygon, then you'll want to use ST_Union() instead of 
ST_Collect().

ST_Union() - returns the point set union of all input geometries,
ST_Collect() - is a simple aggregate function that concatenates 
geometries together, ie a bunch of polygons to a multipolygon.

-- Kevin

Lee Hachadoorian wrote:
> Upgraded to 1.3.3 to get rid of previous problem with ST_Collect, but
> I'm still not getting the output I want.  What I want to do is take
> several polygons and mash them together into one polygon.  The SQL I
> am using is:
> 
> SELECT ST_Collect(the_geom)
> FROM proj_mortgage.geo_hh_race
> WHERE pct_hispanic > 50;
> 
> But ST_Collect returns a GEOMETRYCOLLECTION, and I want a polygon or
> multipolygon.  Do I need to do something with the GEOMETRYCOLLECTION
> returned by ST_Collect, or is ST_Collect the wrong function to use in
> the first place?
> 
> Thanks,
> Lee Hachadoorian
> PhD Student, Geography
> Program in Earth & Environmental Sciences
> CUNY Graduate Center
> _______________________________________________
> 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