Add tileMargin option
This commit is contained in:
parent
e44104254e
commit
17a73b1d4a
2 changed files with 13 additions and 1 deletions
|
@ -27,7 +27,8 @@ Example::
|
|||
"maxSize": 2048,
|
||||
"pbfAlias": "pbf",
|
||||
"serveAllFonts": false,
|
||||
"serveStaticMaps": true
|
||||
"serveStaticMaps": true,
|
||||
"tileMargin": 0
|
||||
},
|
||||
"styles": {
|
||||
"basic": {
|
||||
|
|
|
@ -407,6 +407,13 @@ module.exports = function(options, repo, params, id, publicUrl, dataResolver) {
|
|||
params.width *= 2;
|
||||
params.height *= 2;
|
||||
}
|
||||
|
||||
var tileMargin = Math.max(options.tileMargin || 0, 0);
|
||||
if (z > 2 && tileMargin > 0) {
|
||||
params.width += tileMargin * 2 * scale;
|
||||
params.height += tileMargin * 2 * scale;
|
||||
}
|
||||
|
||||
renderer.render(params, function(err, data) {
|
||||
pool.release(renderer);
|
||||
if (err) {
|
||||
|
@ -422,6 +429,10 @@ module.exports = function(options, repo, params, id, publicUrl, dataResolver) {
|
|||
}
|
||||
});
|
||||
|
||||
if (z > 2 && tileMargin > 0) {
|
||||
image.extract({ left: tileMargin * scale, top: tileMargin * scale, width: width * scale, height: height * scale });
|
||||
}
|
||||
|
||||
if (z == 0) {
|
||||
// HACK: when serving zoom 0, resize the 0 tile from 512 to 256
|
||||
image.resize(width * scale, height * scale);
|
||||
|
|
Loading…
Reference in a new issue