[Qgis-user] aggregate polygon overlay
Simon Dietmann
dietmann at pgnu.de
Tue Feb 17 08:42:15 PST 2026
Thank you all very much for your quick help, that is exactly what I needed!
regards
Simon
Von: Ujaval Gandhi <ujaval at spatialthoughts.com>
Gesendet: Dienstag, 17. Februar 2026 17:35
An: Richard Greenwood <richard.greenwood at gmail.com>
Cc: Karl Magnus Jönsson <Karl-Magnus.Jonsson at kristianstad.se>; Simon Dietmann <dietmann at pgnu.de>; qgis-user <qgis-user at lists.osgeo.org>
Betreff: Re: [Qgis-user] aggregate polygon overlay
A native QGIS solution based on Richard's query. With your union layer of 12 features, use the Processing Toolbox → Vector Geometry → Aggregate tool which offers a group by (geometry) and concatenate (by attribute) options to dissolve features. Screenshot below of the setting that produces 7 polygons with the desired names.
[cid:image001.png at 01DCA034.C07DDD90]
---
Ujaval Gandhi
Spatial Thoughts
www.spatialthoughts.com<http://atpscan.global.hornetsecurity.com?d=d8dEa4wCH-hQR5Bjv5sufCu9FLkfbI9ReCZnoI9rsN8&f=5djPabXCr7ImVU1ijUlfpg_vSK5K90E9sLh1fKQrGo_7Svt_ApKUhcS26yPepvG9&i=&k=4bMi&m=1lYJauxdb9CmZyYyQw1uAXOKHvXYgBW_8nzmtBmP0cFtDj2Vd4BXUpXd7v941ycfINlhg9Ve44ks9B2YvuM39UpeVNeNWtIzMXpBbEVklD55xdlDbaVRgapFJILE_nSf&n=1h85n1s1EXsEq62rMdsOKHCHmdLFYXgjK0wEWNcBwMQkLoUKZG8kjA84Fs5YTVbl&r=ScU01rzvr2-M8KUUcjos2oWU-o8EhA6C39QxGpewIaj7Pipn8RffWKtxM0QNh7pb&s=e519e5f4364a6942ac8cdb77bf0e70a4aeb84fcfa596ed84a3e229e56fbf6810&u=http%3A%2F%2Fwww.spatialthoughts.com>
On Tue, Feb 17, 2026 at 9:51 PM Richard Greenwood via QGIS-User <qgis-user at lists.osgeo.org<mailto:qgis-user at lists.osgeo.org>> wrote:
Here's another postgis solution. I started with your original QGIS union which has 12 polygons. Then in postgis:
select st_union(geom) as unique_geom, string_agg(attrib, ',') as concatenated_attribute
from test
group by geom;
This is an aggregate query the groups by geometry. The "magic" is the string_agg function which concatenates the "attribute" field. The query produces 7 rows (below). The string_agg() function also accepts an ORDER BY if that's important to you.
[cid:image002.png at 01DCA034.C07DDD90]
On Tue, Feb 17, 2026 at 8:23 AM Karl Magnus Jönsson via QGIS-User <qgis-user at lists.osgeo.org<mailto:qgis-user at lists.osgeo.org>> wrote:
Hi Simon!
Seems like a common problem that GIS should handle easy, but it is perhaps not that easy. I had a similar problem that ended up in below. I have my data in Postgres + PostGIS so it is handled by the database in in a view. The code disassembles the polygons in the rings, union the rings and then build polygons again from the lines. Then I do a join with the original data (in this case not exactly) based on location on the centerpoint. In your case I would do a suitable group by and concatenate the attributes. Hope this helps even it is not QGIS.
WITH orings AS (
SELECT st_exteriorring((st_dumprings((st_dump(omr.geom)).geom)).geom) AS geom
FROM qdp2.omr
), oboundaries AS (
SELECT st_union(orings.geom) AS geom
FROM orings
), opoly AS (
SELECT (st_dump(st_polygonize(oboundaries.geom))).geom AS geom
FROM oboundaries
)
SELECT row_number() OVER () AS id,
p.namn,
'delområde'::text AS delomr,
p.plan_uuid,
p.status,
p.publicerad,
op.geom
FROM opoly op,
qdp2.plan_omr po,
qdp2.plan p
WHERE st_contains(po.geom, st_pointonsurface(op.geom)) AND po.plan_uuid = p.plan_uuid
Med vänliga hälsningar
Karl-Magnus Jönsson
Från: QGIS-User <qgis-user-bounces at lists.osgeo.org<mailto:qgis-user-bounces at lists.osgeo.org>> För Simon Dietmann via QGIS-User
Skickat: den 17 februari 2026 15:01
Till: qgis-user <qgis-user at lists.osgeo.org<mailto:qgis-user at lists.osgeo.org>>
Ämne: [Qgis-user] aggregate polygon overlay
Dear list,
I am trying to solve the following problem:
I have one polygon layer with many polygons that are in many cases overlapping and with different attribute valus, e.g. a, b, c:
[cid:image003.png at 01DCA034.C07DDD90]
My goal is to generate a polygon layer with polygons for every overlap constellation containing a concat string of those attributes, in this example seven polygons with the attributes a, b, c, ab, bc, ac, abc.
I started with a union of my original layer, the result is a layer with 12 polygons where overlapping areas of the original polygons result in overlapping intersections containing one of the original attributes each, for example in the middle, there are 3 polygons, one with a, one with b and one with c.
How is it possible to summarize those overlapping polygons into one polygon each with all the attributes, given that there is a large number of polygons and different attributes?
Thank you for any hints,
regards
Simon
i.A. Simon Dietmann
Projektleiter | Geograph
[cid:image004.png at 01DCA034.C07DDD90]
PGNU Planungsgesellschaft Natur & Umwelt mbH
Amtsgericht Frankfurt am Main, HRB 111938;
Geschäftsführer: Dr. Benjamin Hill, Dorit Thurm, Sebastian Braun
Hamburger Allee 45 +++ 60486 Frankfurt am Main
Durchwahl: +49 69 952964-32 +++ Fax: +49 69 952964-99
E-Mail: dietmann at pgnu.de<mailto:dietmann at pgnu.de> +++ Web: www.pgnu.de<http://atpscan.global.hornetsecurity.com?d=JDg-v5DGwXdWX89BwVNMyRQGF40Xq1CewQYFjWUfDi8&f=n9Sg9-QV4s2XTMvf8CXhUSMjrK3MwGZ2y8wuITmh6xmZ8dR_gyQKFlTs6hxL8z1D&i=&k=xZcB&m=0en2jEq2f8OIamTvYmH6kT4zZ-dGZgG3nG8u2gSBmBNiQ_F-jsTNwMdXtVI1R3zQaD0vh46nggfyAqSm2APdAhMM_4yARi4Z8HlkyTlp772HXaMgPvSSNiVQRQ1cKw24&n=_cl35fUja6iTtWlmom-unOxaFqtzzcCHJ9IMQsqKXycRNINqEcfsTq9CLFjkYaCv&r=OP158scICM09EGeskFLYbUPHbNFAZuTgAJDajFW5Kqk0IUp2yOTg4cSB4-Yy0188&s=3f121937f87d54d08e7b82a5461fcd08155f3c32ff14bb283c2d15184ce4b0e6&u=http%3A%2F%2Fwww.pgnu.de>
> Diese E-Mail könnte vertrauliche und/oder rechtlich geschützte Informationen enthalten. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.
> This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
QGIS-User mailing list
QGIS-User at lists.osgeo.org<mailto:QGIS-User at lists.osgeo.org>
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user<https://atpscan.global.hornetsecurity.com?d=h7Xl-pfZs8n4jnHemTYx_HwkggEpl20wn9ZQoDBAMlo&f=s5XBGszaEb2hoZLyyRzx1UDczNgAj37T2gXYmSY8q3NFLwwkz_Vt0litr4VJIErN&i=&k=ICZ9&m=DE4pHUPcJC7QCQ4gdqTix3HQFctAEHr5QQ6NQcD8Xq3KYOR6vk_Cte4wovUfYHpr8iOwU6e0Qvt7KWfA4i9XiMTEpyduCI9sZLgsLHuKlr95XP3u4EBcOWfEqkni7zOn&n=MPaq0Gmxp58CB3y11I1vsPIrdPWYgeUPFM_swsnDLn-U7sc2-cPa5wru0O-a5D8-&r=SbcPFuPNIOu60fw0i3D_wsUY-FemTSbJuJOTqtYpDX0hPCyVqpKyJGlQD34lb7dS&s=c9ff90aa9407651cc9186bea16d74b275353ea4df59dbe8493f80d0b6a2c0c8b&u=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fqgis-user>
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user<https://atpscan.global.hornetsecurity.com?d=h7Xl-pfZs8n4jnHemTYx_HwkggEpl20wn9ZQoDBAMlo&f=s5XBGszaEb2hoZLyyRzx1UDczNgAj37T2gXYmSY8q3NFLwwkz_Vt0litr4VJIErN&i=&k=ICZ9&m=DE4pHUPcJC7QCQ4gdqTix3HQFctAEHr5QQ6NQcD8Xq3KYOR6vk_Cte4wovUfYHpr8iOwU6e0Qvt7KWfA4i9XiMTEpyduCI9sZLgsLHuKlr95XP3u4EBcOWfEqkni7zOn&n=MPaq0Gmxp58CB3y11I1vsPIrdPWYgeUPFM_swsnDLn-U7sc2-cPa5wru0O-a5D8-&r=SbcPFuPNIOu60fw0i3D_wsUY-FemTSbJuJOTqtYpDX0hPCyVqpKyJGlQD34lb7dS&s=c9ff90aa9407651cc9186bea16d74b275353ea4df59dbe8493f80d0b6a2c0c8b&u=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fqgis-user>
--
Richard W. Greenwood
_______________________________________________
QGIS-User mailing list
QGIS-User at lists.osgeo.org<mailto:QGIS-User at lists.osgeo.org>
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user<https://atpscan.global.hornetsecurity.com?d=h7Xl-pfZs8n4jnHemTYx_HwkggEpl20wn9ZQoDBAMlo&f=s5XBGszaEb2hoZLyyRzx1UDczNgAj37T2gXYmSY8q3NFLwwkz_Vt0litr4VJIErN&i=&k=ICZ9&m=DE4pHUPcJC7QCQ4gdqTix3HQFctAEHr5QQ6NQcD8Xq3KYOR6vk_Cte4wovUfYHpr8iOwU6e0Qvt7KWfA4i9XiMTEpyduCI9sZLgsLHuKlr95XP3u4EBcOWfEqkni7zOn&n=MPaq0Gmxp58CB3y11I1vsPIrdPWYgeUPFM_swsnDLn-U7sc2-cPa5wru0O-a5D8-&r=SbcPFuPNIOu60fw0i3D_wsUY-FemTSbJuJOTqtYpDX0hPCyVqpKyJGlQD34lb7dS&s=c9ff90aa9407651cc9186bea16d74b275353ea4df59dbe8493f80d0b6a2c0c8b&u=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fqgis-user>
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user<https://atpscan.global.hornetsecurity.com?d=h7Xl-pfZs8n4jnHemTYx_HwkggEpl20wn9ZQoDBAMlo&f=s5XBGszaEb2hoZLyyRzx1UDczNgAj37T2gXYmSY8q3NFLwwkz_Vt0litr4VJIErN&i=&k=ICZ9&m=DE4pHUPcJC7QCQ4gdqTix3HQFctAEHr5QQ6NQcD8Xq3KYOR6vk_Cte4wovUfYHpr8iOwU6e0Qvt7KWfA4i9XiMTEpyduCI9sZLgsLHuKlr95XP3u4EBcOWfEqkni7zOn&n=MPaq0Gmxp58CB3y11I1vsPIrdPWYgeUPFM_swsnDLn-U7sc2-cPa5wru0O-a5D8-&r=SbcPFuPNIOu60fw0i3D_wsUY-FemTSbJuJOTqtYpDX0hPCyVqpKyJGlQD34lb7dS&s=c9ff90aa9407651cc9186bea16d74b275353ea4df59dbe8493f80d0b6a2c0c8b&u=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fqgis-user>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20260217/86d7e8b7/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 208157 bytes
Desc: image001.png
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20260217/86d7e8b7/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 37475 bytes
Desc: image002.png
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20260217/86d7e8b7/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 45602 bytes
Desc: image003.png
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20260217/86d7e8b7/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 10644 bytes
Desc: image004.png
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20260217/86d7e8b7/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GKKSEHU6IU
Type: image/png
Size: 8911 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20260217/86d7e8b7/attachment-0009.png>
More information about the QGIS-User
mailing list