Collecting multipolygons into a single multipolygon with ST_Collect() in PostGIS

المشرف العام

Administrator
طاقم الإدارة
I would like to collect 50,000 individual multipolygons into one big multipolygon. Unfortunately when I perform ST_Collect(geom) it bundles them into a geometry collection and cannot be cast as ::geometry(MultiPolygonZ, 2193) which is of no use to me.

How do I get prevent this from happening? I have tried wrapping the ST_Collect() in a ST_CollectionExtract() but that merely returns the original 50,000 multipolygons.

Here is the code:

CREATE TABLE new_table AS SELECT 1::INT as id, ST_Collect(geom)::geometry(MultiPolygonZ,2193)FROM old_table

أكثر...
 
أعلى