Merge pull request #269 from ahocevar/wms-extent

Fixing extent check for undefined extents. r=@elemoine
This commit is contained in:
ahocevar
2013-03-05 00:54:12 -08:00
2 changed files with 4 additions and 1 deletions

View File

@@ -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'

View File

@@ -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));