How can I dissolve polygons?

Topics: User Forum
Mar 9, 2007 at 10:19 AM

My query returns a collection of several polygons, but I would like to merge them into one single polygon. I presume that this is done using "ST.GeomUnion(the_geom)" but I get an error message saying that there were not enough arguments provided - I have added the "group by" clause to group the polygons together based on an attribute I have added to the table to ensure that all polygons can be grouped.

Here is my query:

SELECT ST.GeomUnion(the_geom), grouped
  FROM myTable
GROUP BY grouped

Any idea where I am going wrong?


Mar 12, 2007 at 5:04 PM
Try this:
SELECT ST.UnionAggregate(the_geom), grouped
  FROM myTable
GROUP BY grouped

Best regards,
Ricardo Stuven.
Mar 12, 2007 at 6:15 PM
Thanks, I'll try that tomorrow :)
Mar 13, 2007 at 9:34 AM
Thanks, that did the trick. The problem, however, is that it's an incredibly slow operation, so I think I'll have to find some way of processing the data beforehand so that it doesn't have to be done on-the-fly.