Compensate for bbox lack of accuracy

This commit is contained in:
Javier Goizueta
2018-07-16 12:44:30 +02:00
parent e59d0f520a
commit 2d102c4810
2 changed files with 9 additions and 6 deletions
@@ -274,20 +274,23 @@ const spatialFilter = `
// * This queries are used for rendering and the_geom is omitted in the results for better performance
// * If the MVT extent or tile buffer was 0 or a multiple of the resolution we could use directly
// the bbox for them, but in general we need to find the nearest cell limits inside the bbox.
// * bbox coordinates can have an error in the last digites; we apply a small correction before
// applying CEIL or FLOOR to compensate for this.
const sqlParams = (ctx) => `
_cdb_res AS (
SELECT
${gridResolution(ctx)} AS res,
!bbox! AS bbox
!bbox! AS bbox,
(2*2.220446049250313e-16::double precision) AS eps
),
_cdb_params AS (
SELECT
res,
bbox,
CEIL(ST_XMIN(bbox)/res)*res AS xmin,
FLOOR(ST_XMAX(bbox)/res)*res AS xmax,
CEIL(ST_YMIN(bbox)/res)*res AS ymin,
FLOOR(ST_YMAX(bbox)/res)*res AS ymax
CEIL((ST_XMIN(bbox) - eps*ABS(ST_XMIN(bbox)))/res)*res AS xmin,
FLOOR((ST_XMAX(bbox) + eps*ABS(ST_XMAX(bbox)))/res)*res AS xmax,
CEIL((ST_YMIN(bbox) - eps*ABS(ST_YMIN(bbox)))/res)*res AS ymin,
FLOOR((ST_YMAX(bbox) + eps*ABS(ST_YMAX(bbox)))/res)*res AS ymax
FROM _cdb_res
)
`;
+1 -1
View File
@@ -2455,7 +2455,7 @@ describe('aggregation', function () {
});
});
it.skip(`for ${placement} points aggregated into corner cluster`, function (done) {
it(`for ${placement} points aggregated into corner cluster`, function (done) {
// this test will fail due to !bbox! lack of accuracy if strict cell filtering is in place
this.mapConfig = {
version: '1.6.0',