I have the following dataset of polygons. All the pieces are broken based on their borders. I added some transparency to better understand what's going on. The pieces that have stronger colors, means that there're more "spatially equal" polygons in that area (Note by spatially equal I mean ST_Within(A,B) == true and ST_Within(B,A) == true). Stronger the color is, the greater the number of polygons in this area.
I'm using the following code to flatten all the polygons (in other words, I want them all in the same transparency). Although, it works for some of the polygons, it does not flat all my polygons. Am I doing something wrong here?
SELECT
ST_Union(geom) geom,
sum(val) ct_values
FROM tbl_test
GROUP BY ST_Centroid(geom)
The expected output is to have something like the following image. There's no polygon over another.They just touch each other (the reason why there're still differences in the border line color).