diff --git a/externs/olx.js b/externs/olx.js index 2528159664..8348707365 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -6128,7 +6128,7 @@ olx.source.XYZOptions.prototype.maxZoom; /** - * Unsupported (TODO: remove this). + * Optional min zoom level. Default is `0`. * @type {number|undefined} * @api */ diff --git a/src/ol/source/stamensource.js b/src/ol/source/stamensource.js index c82a170139..1137abad12 100644 --- a/src/ol/source/stamensource.js +++ b/src/ol/source/stamensource.js @@ -70,7 +70,7 @@ ol.source.StamenProviderConfig = { maxZoom: 20 }, 'watercolor': { - minZoom: 3, + minZoom: 1, maxZoom: 16 } }; @@ -106,8 +106,7 @@ ol.source.Stamen = function(options) { cacheSize: options.cacheSize, crossOrigin: 'anonymous', maxZoom: providerConfig.maxZoom, - // FIXME uncomment the following when tilegrid supports minZoom - //minZoom: providerConfig.minZoom, + minZoom: providerConfig.minZoom, opaque: layerConfig.opaque, reprojectionErrorThreshold: options.reprojectionErrorThreshold, tileLoadFunction: options.tileLoadFunction, diff --git a/src/ol/source/xyzsource.js b/src/ol/source/xyzsource.js index a9a2aa9aa1..166df55699 100644 --- a/src/ol/source/xyzsource.js +++ b/src/ol/source/xyzsource.js @@ -33,6 +33,7 @@ ol.source.XYZ = function(options) { ol.tilegrid.createXYZ({ extent: ol.tilegrid.extentFromProjection(projection), maxZoom: options.maxZoom, + minZoom: options.minZoom, tileSize: options.tileSize }); diff --git a/test/spec/ol/source/xyzsource.test.js b/test/spec/ol/source/xyzsource.test.js index 337cb773cf..bb1c36a87a 100644 --- a/test/spec/ol/source/xyzsource.test.js +++ b/test/spec/ol/source/xyzsource.test.js @@ -20,6 +20,13 @@ describe('ol.source.XYZ', function() { expect(tileSource.getTileGrid().getTileSize(0)).to.be(512); }); + it('can be constructed with a custom min zoom', function() { + var tileSource = new ol.source.XYZ({ + minZoom: 2 + }); + expect(tileSource.getTileGrid().getMinZoom()).to.be(2); + }); + }); describe('tileUrlFunction', function() {