add tests around mbTile SQKM calculation

This commit is contained in:
Suhas Deshpande
2020-07-09 17:03:21 -07:00
parent df57126f97
commit d6bd7c5a66
6 changed files with 216 additions and 2 deletions
+10
View File
@@ -11,6 +11,7 @@ var tiletype = require('@mapbox/tiletype');
var ZXYStream = require('./zxystream');
var queue = require('d3-queue').queue;
var os = require('os');
var utils = require('./utils.js');
if (process.env.BRIDGE_LOG_MAX_VTILE_BYTES_COMPRESSED) {
var stats = { max:0, total:0, count:0 };
@@ -192,6 +193,15 @@ MBTiles.prototype.getTile = function(z, x, y, callback) {
if (stats.max < tileDataLength) {
stats.max = tileDataLength;
}
var area = stats.hasOwnProperty(z)
? stats[z] + utils.calculateTileArea(z, x, y)
: utils.calculateTileArea(z, x, y);
stats = {
...stats,
[z]: area
};
}
return callback(null, row.tile_data, headers);
}