diff --git a/lib/OpenLayers/Layer/TMS.js b/lib/OpenLayers/Layer/TMS.js index 437bfd79b5..d61ed95d35 100644 --- a/lib/OpenLayers/Layer/TMS.js +++ b/lib/OpenLayers/Layer/TMS.js @@ -13,6 +13,12 @@ */ OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, { + /** + * APIProperty: serviceVersion + * {String} + */ + serviceVersion: "1.0.0", + /** * APIProperty: isBaseLayer * {Boolean} @@ -91,7 +97,7 @@ OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, { var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w)); var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h)); var z = this.map.getZoom(); - var path = "1.0.0" + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type; + var path = this.serviceVersion + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type; var url = this.url; if (url instanceof Array) { url = this.selectUrl(path, url); diff --git a/tests/Layer/test_TMS.html b/tests/Layer/test_TMS.html index 17dc55a803..9fb5629d5b 100644 --- a/tests/Layer/test_TMS.html +++ b/tests/Layer/test_TMS.html @@ -119,7 +119,7 @@ */ function test_10_Layer_TMS_getURL(t) { - t.plan(2); + t.plan(3); var map = new OpenLayers.Map('map', options); var options = {'layername':'basic', 'type':'png'}; @@ -128,6 +128,12 @@ map.setCenter(new OpenLayers.LonLat(0,0), 9); var tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125)); t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/9/261/192.png", "Tile URL is correct"); + + var layer2 = layer.clone(); + layer2.serviceVersion = "1.2.3"; + map.addLayer(layer2); + tileurl = layer2.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125)); + t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.2.3/basic/9/261/192.png", "TMS serviceVersion is correct"); layer.url = ["http://tilecache1/", "http://tilecache2/", "http://tilecache3/"]; tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));