Skip to main content
edited body
Source Link
geozelot
  • 30.9k
  • 4
  • 34
  • 57

Depending on the actual similarity (vertex distribution in particular), you could probably get away with groups over gridded centroids, 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 (say, 0.0001 for degree based CRS), and increase slowly.

Depending on the actual similarity, you could probably get away with groups over gridded centroids, 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 (say, 0.0001 for degree based CRS), and increase slowly.

Depending on the actual similarity (vertex distribution in particular), you could probably get away with groups over gridded centroids, 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 (say, 0.0001 for degree based CRS), and increase slowly.

edited body
Source Link
geozelot
  • 30.9k
  • 4
  • 34
  • 57

Depending on the actual similarity, you could probably get away with groups over a gridded centroidcentroids, 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 (say, 0.0001 for degree based CRS), and increase slowly.

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.

Depending on the actual similarity, you could probably get away with groups over gridded centroids, 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 (say, 0.0001 for degree based CRS), and increase slowly.

Source Link
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.