Chain attributions from mbtiles into the tilejson of the rendered tiles
This commit is contained in:
@@ -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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user