From e5308fec40c3546e78cbfb9a644eaac6311f2e6b Mon Sep 17 00:00:00 2001 From: ahocevar Date: Sat, 27 Oct 2012 17:28:08 +0200 Subject: [PATCH] No extent magic Setting the extent on a tile source now only means that tiles won't be drawn outside that extent. Now the only way to specify the origin of the tile grid is to provide a custom tileGrid. By default, the grid origin is the top left corner of the projection's extent. --- examples/wms.js | 3 ++- src/ol/source/tiledwmssource.js | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/wms.js b/examples/wms.js index f68fcae9ac..e475b8ab65 100644 --- a/examples/wms.js +++ b/examples/wms.js @@ -22,7 +22,8 @@ var layers = new ol.Collection([ source: new ol.source.TiledWMS({ url: 'http://demo.opengeo.org/geoserver/wms', crossOrigin: null, - params: {'LAYERS': 'topp:states', 'TILED': true} + params: {'LAYERS': 'topp:states', 'TILED': true}, + extent: new ol.Extent(-13884991, 2870341, -7455066, 6338219) }) }) ]); diff --git a/src/ol/source/tiledwmssource.js b/src/ol/source/tiledwmssource.js index 32353495a7..327fe92b06 100644 --- a/src/ol/source/tiledwmssource.js +++ b/src/ol/source/tiledwmssource.js @@ -35,14 +35,12 @@ ol.source.TiledWMSOptions; * @param {ol.source.TiledWMSOptions} tiledWMSOptions options. */ ol.source.TiledWMS = function(tiledWMSOptions) { - goog.asserts.assert(tiledWMSOptions.params); - var projection = goog.isDef(tiledWMSOptions.projection) ? tiledWMSOptions.projection : ol.Projection.getFromCode('EPSG:3857'); var projectionExtent = projection.getExtent(); var extent = goog.isDef(tiledWMSOptions.extent) ? - tiledWMSOptions.extent : projection.getExtent(); + tiledWMSOptions.extent : projectionExtent; var version = goog.isDef(tiledWMSOptions.version) ? tiledWMSOptions.version : '1.3'; @@ -60,7 +58,7 @@ ol.source.TiledWMS = function(tiledWMSOptions) { resolutions[z] = size / (256 << z); } tileGrid = new ol.tilegrid.TileGrid({ - origin: extent.getTopLeft(), + origin: projectionExtent.getTopLeft(), resolutions: resolutions }); }