]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/server/tileserver-mapnik/lib/index.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / server / tileserver-mapnik / lib / index.js
1 "use strict";
2
3 module.exports.getInfo = function(source, callback) {
4   return source.getInfo(function(err, _info) {
5     if (err) {
6       return callback(err);
7     }
8
9     var info = {};
10
11     Object.keys(_info).forEach(function(key) {
12       info[key] = _info[key];
13     });
14
15     if (info.vector_layers) {
16       info.format = "pbf";
17       info.scheme = undefined;
18     } else {
19       info.autoscale = true;
20     }
21
22     info.name = info.name || "Untitled";
23     info.center = info.center || [-122.4440, 37.7908, 12];
24     info.bounds = info.bounds || [-180, -85.0511, 180, 85.0511];
25     info.format = info.format || "png";
26     info.minzoom = Math.max(0, info.minzoom | 0);
27     info.maxzoom = info.maxzoom || Infinity;
28
29     info.type = "baselayer";
30
31     return callback(null, info);
32   });
33 };