Fix bug fot not cummulative expires examples
This commit is contained in:
parent
224172d693
commit
827c5af4ed
@ -156,8 +156,9 @@ TimePlayer.prototype.get_time_data = function (tile, coord, zoom) {
|
|||||||
// se contains the deforestation for each entry in sd
|
// se contains the deforestation for each entry in sd
|
||||||
// take se and sd as a matrix [se|sd]
|
// take se and sd as a matrix [se|sd]
|
||||||
var numTiles = 1 << zoom;
|
var numTiles = 1 << zoom;
|
||||||
|
var sql = ""
|
||||||
var sql = "WITH hgrid AS ( " +
|
if ( this.options.cumulative_expires == true) {
|
||||||
|
sql = "WITH hgrid AS ( " +
|
||||||
" SELECT CDB_RectangleGrid( " +
|
" SELECT CDB_RectangleGrid( " +
|
||||||
" CDB_XYZ_Extent({0}, {1}, {2}), ".format(coord.x, coord.y, zoom) +
|
" CDB_XYZ_Extent({0}, {1}, {2}), ".format(coord.x, coord.y, zoom) +
|
||||||
" CDB_XYZ_Resolution({0}) * {1}, ".format(zoom, this.resolution) +
|
" CDB_XYZ_Resolution({0}) * {1}, ".format(zoom, this.resolution) +
|
||||||
@ -182,6 +183,28 @@ TimePlayer.prototype.get_time_data = function (tile, coord, zoom) {
|
|||||||
" floor((date_part('epoch',{0})- {1})/{2}), ".format(this.t_column, this.MIN_DATE, this.step) +
|
" floor((date_part('epoch',{0})- {1})/{2}), ".format(this.t_column, this.MIN_DATE, this.step) +
|
||||||
" floor((date_part('epoch',{0})- {1})/{2})".format(this.options.expiration_column, this.MIN_DATE, this.step) +
|
" floor((date_part('epoch',{0})- {1})/{2})".format(this.options.expiration_column, this.MIN_DATE, this.step) +
|
||||||
" ) f GROUP BY x, y";
|
" ) f GROUP BY x, y";
|
||||||
|
} else {
|
||||||
|
sql = "WITH hgrid AS ( " +
|
||||||
|
" SELECT CDB_RectangleGrid( " +
|
||||||
|
" CDB_XYZ_Extent({0}, {1}, {2}), ".format(coord.x, coord.y, zoom) +
|
||||||
|
" CDB_XYZ_Resolution({0}) * {1}, ".format(zoom, this.resolution) +
|
||||||
|
" CDB_XYZ_Resolution({0}) * {1} ".format(zoom, this.resolution) +
|
||||||
|
" ) as cell " +
|
||||||
|
" ) " +
|
||||||
|
" SELECT " +
|
||||||
|
" x, y, array_agg(c) vals, array_agg(d) dates " +
|
||||||
|
" FROM ( " +
|
||||||
|
" SELECT " +
|
||||||
|
" round(CAST (st_xmax(hgrid.cell) AS numeric),4) x, round(CAST (st_ymax(hgrid.cell) AS numeric),4) y, " +
|
||||||
|
" {0} c, floor((date_part('epoch',{1})- {2})/{3}) d ".format(this.countby, this.t_column, this.MIN_DATE, this.step) +
|
||||||
|
" FROM " +
|
||||||
|
" hgrid, {0} i ".format(this.table) +
|
||||||
|
" WHERE " +
|
||||||
|
" ST_Intersects(i.the_geom_webmercator, hgrid.cell) " +
|
||||||
|
" GROUP BY " +
|
||||||
|
" hgrid.cell, floor((date_part('epoch',{0})- {1})/{2})".format(this.t_column, this.MIN_DATE, this.step) +
|
||||||
|
" ) f GROUP BY x, y";
|
||||||
|
}
|
||||||
|
|
||||||
var prof = Profiler.get('tile fetch');
|
var prof = Profiler.get('tile fetch');
|
||||||
prof.start();
|
prof.start();
|
||||||
|
Loading…
Reference in New Issue
Block a user