diff --git a/examples/xyz-esri.html b/examples/xyz-esri.html
new file mode 100644
index 0000000000..5d59d7b0aa
--- /dev/null
+++ b/examples/xyz-esri.html
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+ XYZ Esri example
+
+
+
+
+
+
+
+
+
+
+
+
+
XYZ Esri example
+
Example of a XYZ source using Esri tiles.
+
+
xyz, esri
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/xyz-esri.js b/examples/xyz-esri.js
new file mode 100644
index 0000000000..aede312ea2
--- /dev/null
+++ b/examples/xyz-esri.js
@@ -0,0 +1,24 @@
+goog.require('ol.Map');
+goog.require('ol.RendererHint');
+goog.require('ol.View2D');
+goog.require('ol.layer.Tile');
+goog.require('ol.proj');
+goog.require('ol.source.XYZ');
+
+
+var map = new ol.Map({
+ target: 'map',
+ layers: [
+ new ol.layer.Tile({
+ source: new ol.source.XYZ({
+ url: 'http://server.arcgisonline.com/ArcGIS/rest/services/' +
+ 'World_Topo_Map/MapServer/tile/{z}/{y}/{x}'
+ })
+ })
+ ],
+ renderer: ol.RendererHint.CANVAS,
+ view: new ol.View2D({
+ center: ol.proj.transform([-121.1, 47.5], 'EPSG:4326', 'EPSG:3857'),
+ zoom: 7
+ })
+});
diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc
index 67add829a9..47e3fd108e 100644
--- a/src/objectliterals.jsdoc
+++ b/src/objectliterals.jsdoc
@@ -605,6 +605,25 @@
* @property {Array.|undefined} urls Urls.
*/
+/**
+ * @typedef {Object} ol.source.XYZOptions
+ * @property {Array.|undefined} attributions Attributions.
+ * @property {null|string|undefined} crossOrigin Cross origin setting for image
+ * requests.
+ * @property {ol.Extent|undefined} extent Extent.
+ * @property {string|undefined} logo Logo.
+ * @property {ol.ProjectionLike} projection Projection.
+ * @property {number|undefined} maxZoom Optional max zoom level. The default is
+ * 18.
+ * @property {number|undefined} minZoom Unsupported (TODO: remove this).
+ * @property {ol.TileUrlFunctionType|undefined} tileUrlFunction Optional
+ * function to get tile URL given a tile coordinate and the projection.
+ * Required if url or urls are not provided.
+ * @property {string|undefined} url URL template. Must include '{x}', '{y}',
+ * and '{z}' placeholders.
+ * @property {Array.|undefined} urls An array of URL templates.
+ */
+
/**
* @typedef {Object} ol.style.IconOptions
* @property {string|ol.expr.Expression} url Icon image url.
diff --git a/src/ol/source/osmsource.js b/src/ol/source/osmsource.js
index cc759a3653..cab05acca9 100644
--- a/src/ol/source/osmsource.js
+++ b/src/ol/source/osmsource.js
@@ -23,8 +23,6 @@ ol.source.OSM = function(opt_options) {
attributions = ol.source.OSM.ATTRIBUTIONS;
}
- var maxZoom = goog.isDef(options.maxZoom) ? options.maxZoom : 18;
-
var url = goog.isDef(options.url) ?
options.url : 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png';
@@ -32,7 +30,7 @@ ol.source.OSM = function(opt_options) {
attributions: attributions,
crossOrigin: 'anonymous',
opaque: true,
- maxZoom: maxZoom,
+ maxZoom: options.maxZoom,
url: url
});
diff --git a/src/ol/source/xyzsource.exports b/src/ol/source/xyzsource.exports
new file mode 100644
index 0000000000..6384d2777f
--- /dev/null
+++ b/src/ol/source/xyzsource.exports
@@ -0,0 +1 @@
+@exportClass ol.source.XYZ ol.source.XYZOptions
diff --git a/src/ol/source/xyzsource.js b/src/ol/source/xyzsource.js
index 0711564798..0f00bc385a 100644
--- a/src/ol/source/xyzsource.js
+++ b/src/ol/source/xyzsource.js
@@ -1,8 +1,6 @@
goog.provide('ol.source.XYZ');
-goog.provide('ol.source.XYZOptions');
goog.require('ol.Attribution');
-goog.require('ol.Projection');
goog.require('ol.TileUrlFunction');
goog.require('ol.TileUrlFunctionType');
goog.require('ol.proj');
@@ -10,21 +8,6 @@ goog.require('ol.source.TileImage');
goog.require('ol.tilegrid.XYZ');
-/**
- * @typedef {{attributions: (Array.|undefined),
- * crossOrigin: (string|undefined),
- * extent: (ol.Extent|undefined),
- * logo: (string|undefined),
- * maxZoom: number,
- * minZoom: (number|undefined),
- * projection: (ol.Projection|undefined),
- * tileUrlFunction: (ol.TileUrlFunctionType|undefined),
- * url: (string|undefined),
- * urls: (Array.|undefined)}}
- */
-ol.source.XYZOptions;
-
-
/**
* @constructor
@@ -49,9 +32,10 @@ ol.source.XYZ = function(options) {
ol.TileUrlFunction.expandUrl(options.url));
}
+ var maxZoom = goog.isDef(options.maxZoom) ? options.maxZoom : 18;
+
var tileGrid = new ol.tilegrid.XYZ({
- maxZoom: options.maxZoom,
- minZoom: options.minZoom
+ maxZoom: maxZoom
});
var tileCoordTransform = tileGrid.createTileCoordTransform({