Skip to content

Commit

Permalink
allow specifying the center in the mbtiles file
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaefer committed Jun 21, 2011
1 parent 1d77ef8 commit 7084386
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/tileset.js
Expand Up @@ -97,11 +97,15 @@ MBTiles.prototype.info = function(callback) {
info.minzoom = parseInt(info.minzoom);
info.maxzoom = parseInt(info.maxzoom);
info.bounds = _(info.bounds.split(',')).map(parseFloat);
info.center = [
(info.bounds[2] - info.bounds[0]) / 2 + info.bounds[0],
(info.bounds[3] - info.bounds[1]) / 2 + info.bounds[1],
(range <= 1) ? info.maxzoom : Math.floor(range * 0.5) + info.minzoom
];
if (info.center) {
info.center = _(info.center.split(',')).map(Number);
} else {
info.center = [
(info.bounds[2] - info.bounds[0]) / 2 + info.bounds[0],
(info.bounds[3] - info.bounds[1]) / 2 + info.bounds[1],
(range <= 1) ? info.maxzoom : Math.floor(range * 0.5) + info.minzoom
];
}
callback(null, info);
});
};
Expand Down

0 comments on commit 7084386

Please sign in to comment.