Be able to aggregate by a field

This commit is contained in:
Daniel García Aubert
2019-03-01 11:21:18 +01:00
parent 92e62069d4
commit 77d5d8ebd4
4 changed files with 181 additions and 53 deletions
@@ -43,7 +43,7 @@ module.exports = class AggregatedFeaturesLayergroupController {
authorize(this.authBackend),
dbConnSetup(this.pgConnection),
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.ATTRIBUTES),
cleanUpQueryParams(),
cleanUpQueryParams([ 'aggregation' ]),
createMapStoreMapConfigProvider(
this.mapStore,
this.userLimitsBackend,
@@ -67,11 +67,13 @@ function getClusteredFeatures (clusterBackend) {
const { user, token } = res.locals;
const { dbuser, dbname, dbpassword, dbhost, dbport } = res.locals;
const { layer, z: zoom, clusterId } = req.params;
const { aggregation } = req.query;
const params = {
user, token,
dbuser, dbname, dbpassword, dbhost, dbport,
layer, zoom, clusterId
layer, zoom, clusterId,
aggregation
};
clusterBackend.getClusterFeatures(mapConfigProvider, params, (err, features, stats = {}) => {