Chain attributions from mbtiles into the tilejson of the rendered tiles
This commit is contained in:
parent
5d940066d9
commit
daa94dc806
1 changed files with 9 additions and 0 deletions
|
@ -140,6 +140,7 @@ module.exports = function(options, repo, params, id) {
|
||||||
var tileJSON = {
|
var tileJSON = {
|
||||||
'tilejson': '2.0.0',
|
'tilejson': '2.0.0',
|
||||||
'name': styleJSON.name,
|
'name': styleJSON.name,
|
||||||
|
'attribution': '',
|
||||||
'basename': id,
|
'basename': id,
|
||||||
'minzoom': 0,
|
'minzoom': 0,
|
||||||
'maxzoom': 20,
|
'maxzoom': 20,
|
||||||
|
@ -147,6 +148,7 @@ module.exports = function(options, repo, params, id) {
|
||||||
'format': 'png',
|
'format': 'png',
|
||||||
'type': 'baselayer'
|
'type': 'baselayer'
|
||||||
};
|
};
|
||||||
|
var attributionOverride = params.tilejson && params.tilejson.attribution;
|
||||||
Object.assign(tileJSON, params.tilejson || {});
|
Object.assign(tileJSON, params.tilejson || {});
|
||||||
tileJSON.tiles = params.domains || options.domains;
|
tileJSON.tiles = params.domains || options.domains;
|
||||||
utils.fixTileJSONCenter(tileJSON);
|
utils.fixTileJSONCenter(tileJSON);
|
||||||
|
@ -190,6 +192,13 @@ module.exports = function(options, repo, params, id) {
|
||||||
map.sources[name].emptyTile = buffer;
|
map.sources[name].emptyTile = buffer;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (!attributionOverride &&
|
||||||
|
source.attribution && source.attribution.length > 0) {
|
||||||
|
if (tileJSON.attribution.length > 0) {
|
||||||
|
tileJSON.attribution += '; ';
|
||||||
|
}
|
||||||
|
tileJSON.attribution += source.attribution;
|
||||||
|
}
|
||||||
callback(null);
|
callback(null);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue