There are two tables in PostGIS. In which, one has polygon geometries with layer name wise and another one table has master layer name list.

The requirement is to collect the polygon geometries as layer wise from first table and update it as Multipolygon in the geometry column of second table that is layer master table. Below screenshot describes the requirement.

But boundaries of the each polygon should be displayed when viewing the second table on QGIS/Pgadmin graphical viewer after updating them as Multipolygon.

Seeking a sample PostGIS queries to achieve the above.

enter image description here



update master as m
set geom = w.geom
    (select st_collect(geom) geom, layer
     from wise
     group by layer) w
where m.layer = w.layer

enter image description here

If you want the borders of overlapping polygons to dissolve then use ST_UNION

  • 1
    Thanks a lot Bera – venkat May 30 '19 at 11:10

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