1

I have a multi polygon with spatial field layer with and 3000 records and I want to use dissolve all in 1 record.

On DISSOLVE algorithm in QGIS you have a choose to dissolve all features from layer that I want with PostGIS.

After the query I want to have one record and this record have all.

I test this query :

SELECT (ST_Dump(ST_union(geom))).geom::geometry(POLYGON,2100) FROM public.parcel1

but don't work; don't create me one record with all features.

What have I done wrong?

4
  • 3
    select st_union(geom) geom from parcel1
    – ziggy
    Sep 23, 2017 at 15:02
  • 2
    the query you have is breaking up the spatial table into many singlepart features
    – ziggy
    Sep 23, 2017 at 15:02
  • @Ziggy that export if I use your details is multipolygon or polygon ? Sep 23, 2017 at 15:41
  • "that export"? dont know what you are talking about. it will be a multipolygon
    – ziggy
    Sep 23, 2017 at 16:13

1 Answer 1

1

To condense all the geometries in a table to one single geometry, you can pass an array to ST_Union:

SELECT ST_Union(ARRAY(SELECT geom FROM tbl))
2
  • 1
    ST_Union has an aggregate function variant, so you should just be able to use SELECT ST_Union(geom) FROM tbl
    – dr_jts
    Jul 6, 2020 at 21:37
  • @dr_jts that's what we use Jul 7, 2020 at 1:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.