[postgis-users] Combined MULTIPOLYGON from subselect on column containing MULTIPOLYGON?
Marcus Jenkins
mgwjenkins at gmail.com
Sun Jan 27 01:03:40 PST 2008
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
More information about the postgis-users
mailing list