Fix interim empty tile generation for raster layers
This commit is contained in:
parent
4082828790
commit
b9930dd195
2 changed files with 6 additions and 4 deletions
|
@ -25,7 +25,7 @@
|
|||
"base64url": "2.0.0",
|
||||
"canvas": "1.6.2",
|
||||
"clone": "2.1.0",
|
||||
"color": "1.0.2",
|
||||
"color": "1.0.3",
|
||||
"cors": "2.8.1",
|
||||
"express": "4.14.0",
|
||||
"glyph-pbf-composite": "0.0.2",
|
||||
|
|
|
@ -230,16 +230,18 @@ module.exports = function(options, repo, params, id, dataResolver) {
|
|||
if (source.format == 'pbf') {
|
||||
map.sources[name].emptyTile = new Buffer(0);
|
||||
} else {
|
||||
var color = new Color(source.color || '#fff');
|
||||
var color = new Color(source.color || 'rgba(255,255,255,0)');
|
||||
var format = source.format;
|
||||
if (format == 'jpg') {
|
||||
format = 'jpeg';
|
||||
}
|
||||
sharp(new Buffer(color.rgbArray()), {
|
||||
var array = color.array();
|
||||
var channels = array.length == 4 && format != 'jpeg' ? 4 : 3;
|
||||
sharp(new Buffer(array), {
|
||||
raw: {
|
||||
width: 1,
|
||||
height: 1,
|
||||
channels: 3
|
||||
channels: channels
|
||||
}
|
||||
}).toFormat(format).toBuffer(function(err, buffer, info) {
|
||||
map.sources[name].emptyTile = buffer;
|
||||
|
|
Loading…
Reference in a new issue