Allow tilelive to pass in tile id. Prepares for delegation of dupe/id detection entirely to tilelive.
This commit is contained in:
+5
-1
@@ -529,7 +529,11 @@ MBTiles.prototype.putTile = function(z, x, y, data, callback) {
|
|||||||
// Flip Y coordinate because MBTiles files are TMS.
|
// Flip Y coordinate because MBTiles files are TMS.
|
||||||
y = (1 << z) - 1 - y;
|
y = (1 << z) - 1 - y;
|
||||||
|
|
||||||
var id = crypto.createHash('md5').update(data).digest('hex');
|
// Allow tilelive to pass us a data.id. If not, generate an md5
|
||||||
|
// from the image buffer data.
|
||||||
|
// @TODO refactor this such that it is entirely tilelive's responsibility
|
||||||
|
// to assign an ID to tiles and identify blanks. We're halfway there.
|
||||||
|
var id = data.id || crypto.createHash('md5').update(data).digest('hex');
|
||||||
if (!this._tileCache[id]) {
|
if (!this._tileCache[id]) {
|
||||||
// This corresponds to the images table.
|
// This corresponds to the images table.
|
||||||
this._tileCache[id] = data;
|
this._tileCache[id] = data;
|
||||||
|
|||||||
Reference in New Issue
Block a user