From 19aeb041414d844b5630859f077de82532cddadc Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 5 Mar 2013 09:47:52 +0100 Subject: [PATCH] Fixing extent check for undefined extents. Thanks @marcjansen for spotting this. To make the epsg-4326 example work, I also had to change the WMS version to 1.1.1. --- examples/epsg-4326.js | 1 + src/ol/source/tiledwmssource.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/epsg-4326.js b/examples/epsg-4326.js index ba95c06146..b7a96014ef 100644 --- a/examples/epsg-4326.js +++ b/examples/epsg-4326.js @@ -27,6 +27,7 @@ var layers = new ol.Collection([ source: new ol.source.TiledWMS({ url: 'http://vmap0.tiles.osgeo.org/wms/vmap0', crossOrigin: null, + version: '1.1.1', params: { 'LAYERS': 'basic', 'FORMAT': 'image/jpeg' diff --git a/src/ol/source/tiledwmssource.js b/src/ol/source/tiledwmssource.js index 7ba0401cdd..ebc8e7ab8c 100644 --- a/src/ol/source/tiledwmssource.js +++ b/src/ol/source/tiledwmssource.js @@ -49,9 +49,11 @@ ol.source.TiledWMS = function(tiledWMSOptions) { var x = tileCoord.x; var tileExtent = tileGrid.getTileCoordExtent(tileCoord); var projectionExtent = projection.getExtent(); + var extent = goog.isDef(tiledWMSOptions.extent) ? + tiledWMSOptions.extent : projectionExtent; // FIXME do we want a wrapDateLine param? The code below will break maps // with projections that do not span the whole world width. - if (extent && extent.minX === projectionExtent.minX && + if (extent.minX === projectionExtent.minX && extent.maxX === projectionExtent.maxX) { var numCols = Math.ceil( (extent.maxX - extent.minX) / (tileExtent.maxX - tileExtent.minX));