diff --git a/lib/OpenLayers/Layer/WMS/Untiled.js b/lib/OpenLayers/Layer/WMS/Untiled.js index dee755a86c..356b30c7e0 100644 --- a/lib/OpenLayers/Layer/WMS/Untiled.js +++ b/lib/OpenLayers/Layer/WMS/Untiled.js @@ -23,6 +23,10 @@ OpenLayers.Layer.WMS.Untiled.prototype = }, reproject: true, + /** the ratio of image/tile size to map size (this is the untiled buffer) + * @type int */ + ratio: 2, + /** @type OpenLayers.Tile.Image */ tile: null, @@ -125,16 +129,18 @@ OpenLayers.Layer.WMS.Untiled.prototype = //determine new tile bounds var center = bounds.getCenterLonLat(); + var tileWidth = bounds.getWidth() * this.ratio; + var tileHeight = bounds.getHeight() * this.ratio; var tileBounds = - new OpenLayers.Bounds(center.lon - bounds.getWidth(), - center.lat - bounds.getHeight(), - center.lon + bounds.getWidth(), - center.lat + bounds.getHeight()); + new OpenLayers.Bounds(center.lon - (tileWidth / 2), + center.lat - (tileHeight / 2), + center.lon + (tileWidth / 2), + center.lat + (tileHeight / 2)); //determine new tile size var tileSize = this.map.getSize(); - tileSize.w = tileSize.w * 2; - tileSize.h = tileSize.h * 2; + tileSize.w = tileSize.w * this.ratio; + tileSize.h = tileSize.h * this.ratio; //formulate request url string var url = this.getURL(tileBounds); @@ -156,8 +162,8 @@ OpenLayers.Layer.WMS.Untiled.prototype = getURL: function(bounds) { var tileSize = this.map.getSize(); - tileSize.w = tileSize.w * 2; - tileSize.h = tileSize.h * 2; + tileSize.w = tileSize.w * this.ratio; + tileSize.h = tileSize.h * this.ratio; return this.getFullRequestString( {'BBOX': bounds.toBBOX(), 'WIDTH': tileSize.w, 'HEIGHT': tileSize.h} );