Configurable optional alias for .pbf tiles (#109)

This commit is contained in:
Petr Sloup
2017-01-25 09:43:34 +01:00
parent 1079ece860
commit 6231f9f7a7
4 changed files with 24 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ var async = require('async'),
var clone = require('clone'),
glyphCompose = require('glyph-pbf-composite');
module.exports.getTileUrls = function(req, domains, path, format) {
module.exports.getTileUrls = function(req, domains, path, format, aliases) {
if (domains) {
if (domains.constructor === String && domains.length > 0) {
@@ -28,6 +28,10 @@ module.exports.getTileUrls = function(req, domains, path, format) {
}
var query = queryParams.length > 0 ? ('?' + queryParams.join('&')) : '';
if (aliases && aliases[format]) {
format = aliases[format];
}
var uris = [];
domains.forEach(function(domain) {
uris.push(req.protocol + '://' + domain + '/' + path +