Add missing aggregation columns to ST_AsMVT

Aggregation results always should have the cartodb_id and the feature count
This commit is contained in:
Javier Goizueta 2018-04-04 17:18:56 +02:00
parent 3d36802686
commit e8cd6856b5

View File

@ -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) {