Skip to main content
1 of 3
geozelot
  • 30.9k
  • 4
  • 34
  • 57

Depending on the actual similarity, you could probably get away with groups over a gridded centroid, e.g.

SELECT
  ARRAY_AGG(id) AS ids,
  ST_Union(geom) AS geom
FROM
  data1
GROUP BY
  ST_SnapToGrid(ST_Centroid(geom), <grid_size>)
;

where you just need to find a suitable <grid_size> - start small, and increase slowly.

geozelot
  • 30.9k
  • 4
  • 34
  • 57