Use unique cartodb_id in aggregated results
See #889 FOr centroid and point-grid the cartodb_id wasn't unique across tiles.
This commit is contained in:
parent
9818d8bb6c
commit
ffa3a96f1a
@ -290,7 +290,7 @@ const aggregationQueryTemplates = {
|
|||||||
!bbox! AS bbox
|
!bbox! AS bbox
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
row_number() over() AS cartodb_id,
|
MIN(_cdb_query.cartodb_id) AS cartodb_id,
|
||||||
ST_SetSRID(
|
ST_SetSRID(
|
||||||
ST_MakePoint(
|
ST_MakePoint(
|
||||||
AVG(ST_X(_cdb_query.the_geom_webmercator)),
|
AVG(ST_X(_cdb_query.the_geom_webmercator)),
|
||||||
@ -317,6 +317,7 @@ const aggregationQueryTemplates = {
|
|||||||
),
|
),
|
||||||
_cdb_clusters AS (
|
_cdb_clusters AS (
|
||||||
SELECT
|
SELECT
|
||||||
|
MIN(_cdb_query.cartodb_id) AS cartodb_id,
|
||||||
Floor(ST_X(_cdb_query.the_geom_webmercator)/_cdb_params.res)::int AS _cdb_gx,
|
Floor(ST_X(_cdb_query.the_geom_webmercator)/_cdb_params.res)::int AS _cdb_gx,
|
||||||
Floor(ST_Y(_cdb_query.the_geom_webmercator)/_cdb_params.res)::int AS _cdb_gy
|
Floor(ST_Y(_cdb_query.the_geom_webmercator)/_cdb_params.res)::int AS _cdb_gy
|
||||||
${dimensionDefs(ctx)}
|
${dimensionDefs(ctx)}
|
||||||
@ -327,7 +328,7 @@ const aggregationQueryTemplates = {
|
|||||||
${havingClause(ctx)}
|
${havingClause(ctx)}
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
row_number() over() AS cartodb_id,
|
_cdb_clusters.cartodb_id AS cartodb_id,
|
||||||
ST_SetSRID(ST_MakePoint((_cdb_gx+0.5)*res, (_cdb_gy+0.5)*res), 3857) AS the_geom_webmercator
|
ST_SetSRID(ST_MakePoint((_cdb_gx+0.5)*res, (_cdb_gy+0.5)*res), 3857) AS the_geom_webmercator
|
||||||
${dimensionNames(ctx)}
|
${dimensionNames(ctx)}
|
||||||
${aggregateColumnNames(ctx)}
|
${aggregateColumnNames(ctx)}
|
||||||
|
Loading…
Reference in New Issue
Block a user