From 2e7784ddf2d8f8829b5bccea0e26ac5d6d1708be Mon Sep 17 00:00:00 2001 From: Javier Goizueta Date: Thu, 1 Feb 2018 10:26:52 +0100 Subject: [PATCH] Add comment to clafify aggregation resolution limit --- lib/cartodb/models/aggregation/aggregation-query.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cartodb/models/aggregation/aggregation-query.js b/lib/cartodb/models/aggregation/aggregation-query.js index e3ad24e3..16e897ab 100644 --- a/lib/cartodb/models/aggregation/aggregation-query.js +++ b/lib/cartodb/models/aggregation/aggregation-query.js @@ -131,6 +131,8 @@ const dimensionDefs = ctx => { // This is equivalent to `${256/ctx.res}*CDB_XYZ_Resolution(CDB_ZoomFromScale(!scale_denominator!))` // This is defined by the ctx.res parameter, which is the number of grid cells per tile linear dimension // (i.e. each tile is divided into ctx.res*ctx.res cells). +// We limit the the minimum resolution to avoid division by zero problems. The limit used is +// the pixel size of zoom level 30 (i.e. 1/2*(30+8) of the full earth web-mercator extent), which is about 0.15 mm. const gridResolution = ctx => { const minimumResolution = 2*Math.PI*6378137/Math.pow(2,38); return `GREATEST(${256*0.00028/ctx.res}*!scale_denominator!, ${minimumResolution})::double precision`;