1

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

closed as off-topic by PolyGeo May 30 at 9:45

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

2

Try ST_COLLECT:

update master as m
set geom = w.geom
from
    (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 at 11:10

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