diff --git a/L.TileLayer.Zoomify.js b/L.TileLayer.Zoomify.js index 65da270..5774805 100644 --- a/L.TileLayer.Zoomify.js +++ b/L.TileLayer.Zoomify.js @@ -94,7 +94,16 @@ L.TileLayer.Zoomify = L.TileLayer.extend({ }, getTileUrl: function (tilePoint) { - return this._url + 'TileGroup' + this._getTileGroup(tilePoint) + '/' + this._map.getZoom() + '-' + tilePoint.x + '-' + tilePoint.y + '.jpg'; + var url = this._url; + + if (this.options != null && (typeof this.options["subdomains"] === "string")) { + var subdomains = this.options.subdomains.split(''); + var subdomain = subdomains[Math.floor(Math.random() * subdomains.length)]; + + url = url.replace("{s}", subdomain); + } + + return url + 'TileGroup' + this._getTileGroup(tilePoint) + '/' + this._map.getZoom() + '-' + tilePoint.x + '-' + tilePoint.y + '.jpg'; }, _getTileGroup: function (tilePoint) {