diff --git a/examples/tilecache.html b/examples/tilecache.html index 605f0c25ff..901f8dccc7 100644 --- a/examples/tilecache.html +++ b/examples/tilecache.html @@ -13,12 +13,17 @@ function init(){ map = new OpenLayers.Map( $('map')); layer = new OpenLayers.Layer.TileCache("TileCache Layer", - ["http://c0.labs.metacarta.com/wms-c/cache/", - "http://c1.labs.metacarta.com/wms-c/cache/", - "http://c2.labs.metacarta.com/wms-c/cache/", - "http://c3.labs.metacarta.com/wms-c/cache/", - "http://c4.labs.metacarta.com/wms-c/cache/"], - "basic", {'format': 'image/png'}); + ["http://c0.labs.metacarta.com/wms-c/cache/", + "http://c1.labs.metacarta.com/wms-c/cache/", + "http://c2.labs.metacarta.com/wms-c/cache/", + "http://c3.labs.metacarta.com/wms-c/cache/", + "http://c4.labs.metacarta.com/wms-c/cache/"], + "basic", + { + 'format': 'image/png', + maxResolution: 180/256 // same as the TileCache config + } + ); map.addLayer(layer); map.setCenter(new OpenLayers.LonLat(0, 0), 0); } @@ -41,12 +46,17 @@

- Demonstrates a TileCache layer that loads tiles from from a web accessible disk-based cache only. + Demonstrates a TileCache layer that loads tiles from from a web + accessible disk-based cache only.

-
+
+ This layer should be used for web accessible disk-based caches only. + It is not used to request new tiles from TileCache. Note that you + should specify resolutions explicitly on this layer so that they match + your TileCache configuration.
diff --git a/lib/OpenLayers/Layer/TileCache.js b/lib/OpenLayers/Layer/TileCache.js index e86e8fc5be..2c14e9bc9b 100644 --- a/lib/OpenLayers/Layer/TileCache.js +++ b/lib/OpenLayers/Layer/TileCache.js @@ -31,7 +31,7 @@ OpenLayers.Layer.TileCache = OpenLayers.Class(OpenLayers.Layer.Grid, { * bottom left of the maxExtent. */ tileOrigin: null, - + /** * APIProperty: format * {String} Mime type of the images returned. Default is image/png. @@ -48,10 +48,13 @@ OpenLayers.Layer.TileCache = OpenLayers.Class(OpenLayers.Layer.Grid, { * your tilecache script!) * layername - {String} Layer name as defined in the TileCache * configuration - * options - {Object} Hashtable of extra options to tag onto the layer + * options - {Object} Optional object with properties to be set on the + * layer. Note that you should speficy your resolutions to match + * your TileCache configuration. This can be done by setting + * the resolutions array directly (here or on the map), by setting + * maxResolution and numZoomLevels, or by using scale based properties. */ initialize: function(name, url, layername, options) { - options = OpenLayers.Util.extend({maxResolution: 180/256}, options); this.layername = layername; OpenLayers.Layer.Grid.prototype.initialize.apply(this, [name, url, {}, options]); diff --git a/tests/Layer/test_TileCache.html b/tests/Layer/test_TileCache.html index 7d617e3aac..41f8f60631 100644 --- a/tests/Layer/test_TileCache.html +++ b/tests/Layer/test_TileCache.html @@ -2,37 +2,47 @@