Fix long lines

This commit is contained in:
Javier Goizueta
2018-07-16 11:58:56 +02:00
parent 7b597e0223
commit 2063ac15ee
2 changed files with 12 additions and 9 deletions
@@ -245,7 +245,8 @@ const havingClause = ctx => {
// inaccurate results due to rounding present in those values.
const gridResolution = ctx => {
const minimumResolution = 2*Math.PI*6378137/Math.pow(2,38);
return `GREATEST(${256/ctx.res}*CDB_XYZ_Resolution(CDB_ZoomFromScale(!scale_denominator!)), ${minimumResolution})::double precision`;
const pixelSize = 'CDB_XYZ_Resolution(CDB_ZoomFromScale(!scale_denominator!))';
return `GREATEST(${256/ctx.res}*${pixelSize}, ${minimumResolution})::double precision`;
};
// Each aggregation cell is defined by the cell coordinates Floor(x/res), Floor(y/res),
@@ -260,8 +261,10 @@ const gridResolution = ctx => {
// conditions for spatial filtering.
const spatialFilter = `
(_cdb_query.the_geom_webmercator && _cdb_params.bbox) AND
ST_X(_cdb_query.the_geom_webmercator) >= _cdb_params.xmin AND ST_X(_cdb_query.the_geom_webmercator) < _cdb_params.xmax AND
ST_Y(_cdb_query.the_geom_webmercator) >= _cdb_params.ymin AND ST_Y(_cdb_query.the_geom_webmercator) < _cdb_params.ymax
ST_X(_cdb_query.the_geom_webmercator) >= _cdb_params.xmin AND
ST_X(_cdb_query.the_geom_webmercator) < _cdb_params.xmax AND
ST_Y(_cdb_query.the_geom_webmercator) >= _cdb_params.ymin AND
ST_Y(_cdb_query.the_geom_webmercator) < _cdb_params.ymax
`;
// Notes:
+6 -6
View File
@@ -2375,7 +2375,7 @@ describe('aggregation', function () {
});
});
it(`for ${placement} each aggr. cell is in a single tile`, function (done) {
it.only(`for ${placement} each aggr. cell is in a single tile`, function (done) {
this.mapConfig = {
version: '1.6.0',
buffersize: { 'mvt': 0 },
@@ -2487,16 +2487,16 @@ describe('aggregation', function () {
const tile = JSON.parse(mvt.toGeoJSONSync(0));
assert.equal(tile.features.length, 1);
assert.equal(tile.features[0].properties._cdb_feature_count, 4);
console.log(tile.features[0].properties);
if (placement === 'point-grid') {
// check geometry x = 18181005.874444414, y = -18181043.94366749
assert.deepEqual(tile.features[0].geometry.coordinates, [ 163.322754576802, -83.3823797469878 ]);
const expectedPoint = [ 163.322754576802, -83.3823797469878 ];
assert.deepEqual(tile.features[0].geometry.coordinates, expectedPoint);
}
done();
});
});
it(`for ${placement} points aggregated into correct cluster`, function (done) {
it.only(`for ${placement} points aggregated into correct cluster`, function (done) {
this.mapConfig = {
version: '1.6.0',
buffersize: { 'mvt': 0 },
@@ -2527,10 +2527,10 @@ describe('aggregation', function () {
const tile = JSON.parse(mvt.toGeoJSONSync(0));
assert.equal(tile.features.length, 1);
assert.equal(tile.features[0].properties._cdb_feature_count, 4);
console.log(tile.features[0].properties);
if (placement === 'point-grid') {
// check geometry x = 18181006.023735486, y = -18181043.794376418
assert.deepEqual(tile.features[0].geometry.coordinates, [ 163.322755917907, -83.3823795924354 ]);
const expectedPoint = [ 163.322755917907, -83.3823795924354 ];
assert.deepEqual(tile.features[0].geometry.coordinates, expectedPoint);
}
done();
});