Merge branch 'mapconfig-aggregation' of github.com:CartoDB/Windshaft-cartodb into mapconfig-aggregation
This commit is contained in:
@@ -357,7 +357,9 @@ LayergroupController.prototype.center = function(req, res, next) {
|
||||
|
||||
LayergroupController.prototype.staticMap = function(req, res, width, height, zoom /* bounds */, center, next) {
|
||||
var format = req.params.format === 'jpg' ? 'jpeg' : 'png';
|
||||
req.params.format = req.params.format || 'png';
|
||||
// We force always the tile to be generated using PNG because
|
||||
// is the only format we support by now
|
||||
res.locals.format = 'png';
|
||||
res.locals.layer = res.locals.layer || 'all';
|
||||
|
||||
var self = this;
|
||||
@@ -507,4 +509,4 @@ function validateLayerRouteMiddleware(req, res, next) {
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ NamedMapsController.prototype.register = function(app) {
|
||||
userMiddleware,
|
||||
this.prepareContext,
|
||||
this.tile.bind(this),
|
||||
vectorError()
|
||||
vectorError()
|
||||
);
|
||||
|
||||
app.get(
|
||||
@@ -121,7 +121,9 @@ NamedMapsController.prototype.staticMap = function(req, res, next) {
|
||||
var cdbUser = res.locals.user;
|
||||
|
||||
var format = req.params.format === 'jpg' ? 'jpeg' : 'png';
|
||||
res.locals.format = req.params.format || 'png';
|
||||
// We force always the tile to be generated using PNG because
|
||||
// is the only format we support by now
|
||||
res.locals.format = 'png';
|
||||
res.locals.layer = res.locals.layer || 'all';
|
||||
|
||||
var namedMapProvider;
|
||||
|
||||
@@ -80,31 +80,24 @@ const aggregationQueryTemplates = {
|
||||
`,
|
||||
|
||||
'point-grid': ctx => `
|
||||
WITH _cdb_params AS (
|
||||
SELECT
|
||||
(${ctx.res*0.00028/256}*!scale_denominator!)::double precision AS res,
|
||||
!bbox! AS bbox
|
||||
),
|
||||
_cdb_clusters AS (
|
||||
SELECT
|
||||
ST_SetSRID(
|
||||
ST_MakePoint(
|
||||
AVG(ST_X(_cdb_query.the_geom_webmercator)),
|
||||
AVG(ST_Y(_cdb_query.the_geom_webmercator))
|
||||
),
|
||||
3857
|
||||
) AS the_geom_webmercator,
|
||||
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,
|
||||
${aggregateColumns(ctx)}
|
||||
FROM (${ctx.sourceQuery}) _cdb_query, _cdb_params
|
||||
WHERE the_geom_webmercator && _cdb_params.bbox
|
||||
GROUP BY _cdb_gx, _cdb_gy
|
||||
)
|
||||
WITH _cdb_params AS (
|
||||
SELECT
|
||||
ST_SetSRID(ST_MakePoint(_cdb_gx*(res+0.5), _cdb_gy*(res*0.5)), 3857) AS the_geom_webmercator,
|
||||
_cdb_feature_count
|
||||
FROM _cdb_clusters, _cdb_params
|
||||
(${ctx.res*0.00028/256}*!scale_denominator!)::double precision AS res,
|
||||
!bbox! AS bbox
|
||||
),
|
||||
_cdb_clusters AS (
|
||||
SELECT
|
||||
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,
|
||||
${aggregateColumns(ctx)}
|
||||
FROM (${ctx.sourceQuery}) _cdb_query, _cdb_params
|
||||
WHERE the_geom_webmercator && _cdb_params.bbox
|
||||
GROUP BY _cdb_gx, _cdb_gy
|
||||
)
|
||||
SELECT
|
||||
ST_SetSRID(ST_MakePoint(_cdb_gx*(res+0.5), _cdb_gy*(res*0.5)), 3857) AS the_geom_webmercator,
|
||||
_cdb_feature_count
|
||||
FROM _cdb_clusters, _cdb_params
|
||||
`,
|
||||
|
||||
'point-sample': ctx => `
|
||||
|
||||
Reference in New Issue
Block a user