New index and viewer (+ templating system)

This commit is contained in:
Petr Sloup
2016-03-16 20:47:11 +01:00
parent d0c0430dca
commit 837cb7d1fb
12 changed files with 392 additions and 92 deletions
+12
View File
@@ -143,6 +143,18 @@ module.exports = function(options, repo, params, id) {
};
Object.assign(tileJSON, params.tilejson || {});
tileJSON.tiles = params.domains || options.domains;
if (tileJSON.bounds && !tileJSON.center) {
var fitWidth = 1024;
var tiles = fitWidth / 256;
tileJSON.center = [
(tileJSON.bounds[0] + tileJSON.bounds[2]) / 2,
(tileJSON.bounds[1] + tileJSON.bounds[3]) / 2,
Math.round(
-Math.log((tileJSON.bounds[2] - tileJSON.bounds[0]) / 360 / tiles) /
Math.LN2
)
];
}
var queue = [];
Object.keys(styleJSON.sources).forEach(function(name) {