My current query is:
SELECT
(ST_Dump( ST_Union( way ) )).geom AS way,
10000 AS way_pixels
FROM (
SELECT
way,
way_pixels,
FROM polygons
) AS test
it works fine to obtain and dissolve and split into indivisual polygons. But is there a reasonable way to compute sum of way_pixels attribute over merged polygons?
For example polygons A, B, C were merged. A has way_pixels value of 20, B of 120 and C of 19. So I want merged polygon to have way_pixels set to 159, not 10000 as it is done currently.
Computing sum has a known problem. With overlapping rather than joining polygons it is going to produce misleading values. But it is preferable to assuming that size is always 10000.
ST_Area is not solution as way_pixels values are not real area but projected area (in Web Mercator).
Merge two polygons, attributes are added - Tool? and Sum of attributes in Spatial join when polygons cross boundaries in ArcMap? Sum attribute in overlapping polygons are similar but about ArcGis