From e8cd6856b52643c145a89e19adcce0dc23d8a96f Mon Sep 17 00:00:00 2001 From: Javier Goizueta Date: Wed, 4 Apr 2018 17:18:56 +0200 Subject: [PATCH] Add missing aggregation columns to ST_AsMVT Aggregation results always should have the cartodb_id and the feature count --- lib/cartodb/models/aggregation/aggregation-mapconfig.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cartodb/models/aggregation/aggregation-mapconfig.js b/lib/cartodb/models/aggregation/aggregation-mapconfig.js index d3666897..548f95d3 100644 --- a/lib/cartodb/models/aggregation/aggregation-mapconfig.js +++ b/lib/cartodb/models/aggregation/aggregation-mapconfig.js @@ -171,6 +171,8 @@ module.exports = class AggregationMapConfig extends MapConfig { _getLayerAggregationRequiredColumns (index) { const { columns, dimensions } = this.getAggregation(index); + let finalColumns = ['cartodb_id', '_cdb_feature_count']; + let aggregatedColumns = []; if (columns) { aggregatedColumns = Object.keys(columns); @@ -181,7 +183,7 @@ module.exports = class AggregationMapConfig extends MapConfig { dimensionsColumns = Object.keys(dimensions); } - return removeDuplicates(aggregatedColumns.concat(dimensionsColumns)); + return removeDuplicates(finalColumns.concat(aggregatedColumns).concat(dimensionsColumns)); } doesLayerReachThreshold(index, featureCount) {