[postgis-users] Combined MULTIPOLYGON from subselect on column containing MULTIPOLYGON?

Ben Jubb benjubb at refractions.net
Mon Jan 28 08:59:16 PST 2008


Hi,
Did you try using the aggregate ST_Union to merge your geometries?

b

Marcus Jenkins wrote:
> Hi
>
> I'm trying to make a (new, larger) multipolygon from a number of rows
> that are selected using an aggregate function ST_Collect.  The problem
> is that the ST_Collect creates a geometrycollection which I can't work
> out how to merge into a new multipolygon, even though the source
> column only contained multipolygon.  I've RTFM a few times...
> ...help?!
>
> My current insert statement looks something like this - I get no
> error, but the output is null in the output column.
>
> insert into my_output_table (id, the_geom, debug_text) select s.id,
> ST_MPolyFromText(ST_AsText(ST_Collect(s.the_geom))),
> ST_AsText(ST_Collect(s.the_geom)) from my_source_table s group by id;
>
> The debug_text column gets filled with lots of nice WKT of
> GEOMETRYCOLLECTION, but we kind of expected that already ;-)
>
> Any clues greatly appreciated.  Otherwise I will be forced to do
> something horrible in Perl like do the select, dismember each
> MULTIPOLYGON record in the source table grouped as per the  select
> above and then craft WKT to make an insert statement to populate my
> output table.  /Surely/ I don't have to resort to this kludgery?
>
> Regards
>
> Marcus
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>   
-------------- next part --------------
A non-text attachment was scrubbed...
Name: benjubb.vcf
Type: text/x-vcard
Size: 255 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080128/430c884f/attachment.vcf>


More information about the postgis-users mailing list