Change the cartodb_ids of aggregated overviews

Instead of arbitrary ids, the id of one of the aggregated records
is used, so that if it is used in the UI to query point
the information of one of the records grouped at the point will be
retrieved.
This commit is contained in:
Javier Goizueta 2016-01-04 10:33:39 +01:00
parent 08828b8b7d
commit 4580c9cd5c

View File

@ -386,7 +386,7 @@ AS $$
SUM(ST_Y(f.the_geom_webmercator)) AS sy, SUM(ST_Y(f.the_geom_webmercator)) AS sy,
Floor(ST_X(f.the_geom_webmercator)/%2$s)::int AS gx, Floor(ST_X(f.the_geom_webmercator)/%2$s)::int AS gx,
Floor(ST_Y(f.the_geom_webmercator)/%2$s)::int AS gy, Floor(ST_Y(f.the_geom_webmercator)/%2$s)::int AS gy,
row_number() OVER () AS cartodb_id MIN(cartodb_id) AS cartodb_id
FROM %1$s f FROM %1$s f
GROUP BY gx, gy GROUP BY gx, gy
) )