I've some geometries stored in this table (140k)
CREATE TABLE buffers (pk integer NOT NULL,geom geometry(MultiPolygon,4326),)

and i would like to create (if possible) a new table (buffersmerged) that will contain the resultants geometries where the previews are grouped just when them are intersecting between each other.
My expected output, it is like when using in QGIS the Buffer(s) tool checking on "dissolve buffer results", but i would like, rather than just a big unique geometry as output, more small groups (one for each group of intersecting geometries)

can you please help me to understand how can I construct a query that allows me to do that? (Postgres + PostGIS enabled) Thank You
Stefano
Do you need the attributes too?
If not, this query should do the job:
CREATE TABLE buffersmerged AS
SELECT (ST_dump(ST_union(a.geom))).geom
FROM buffers a, buffers b
WHERE ST_intersects(a.geom,b.geom) AND a.id != b.id;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With