diff --git a/examples/bing-tiles-restrictedzoom.html b/examples/bing-tiles-restrictedzoom.html
index 992bd143ab..afbd6a9fb6 100644
--- a/examples/bing-tiles-restrictedzoom.html
+++ b/examples/bing-tiles-restrictedzoom.html
@@ -2,7 +2,7 @@
-
+
Basic Bing Tiles with a Subset of Resolutions Example
diff --git a/examples/canvas-hit-detection.html b/examples/canvas-hit-detection.html
index 5148b70633..2f86ea739b 100644
--- a/examples/canvas-hit-detection.html
+++ b/examples/canvas-hit-detection.html
@@ -3,7 +3,7 @@
OpenLayers Canvas Hit Detection Example
-
+
diff --git a/examples/draw-undo-redo.html b/examples/draw-undo-redo.html
index 40ad3e2995..6d5fa720ea 100644
--- a/examples/draw-undo-redo.html
+++ b/examples/draw-undo-redo.html
@@ -3,7 +3,7 @@
OpenLayers Undo/Redo Drawing Methods
-
+
diff --git a/examples/editing-methods.html b/examples/editing-methods.html
index eeab9166de..5a28710407 100644
--- a/examples/editing-methods.html
+++ b/examples/editing-methods.html
@@ -3,7 +3,7 @@
OpenLayers Editing Methods
-
+
diff --git a/examples/point-grid.html b/examples/point-grid.html
index 4cff89d85b..8508fdb473 100644
--- a/examples/point-grid.html
+++ b/examples/point-grid.html
@@ -1,7 +1,7 @@
-
+
OpenLayers Point Grid Example
diff --git a/examples/snap-grid.html b/examples/snap-grid.html
index b6b592d23e..9d0604bd69 100644
--- a/examples/snap-grid.html
+++ b/examples/snap-grid.html
@@ -1,7 +1,7 @@
-
+
OpenLayers Snap Grid Example
diff --git a/lib/OpenLayers/Format/WMTSCapabilities.js b/lib/OpenLayers/Format/WMTSCapabilities.js
index bc5d35d211..6ed811ad99 100644
--- a/lib/OpenLayers/Format/WMTSCapabilities.js
+++ b/lib/OpenLayers/Format/WMTSCapabilities.js
@@ -114,10 +114,13 @@ OpenLayers.Format.WMTSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Vers
layer = new OpenLayers.Layer.WMTS(
OpenLayers.Util.applyDefaults(config, {
- url: capabilities.operationsMetadata.GetTile.dcp.http.get,
+ url: config.requestEncoding === "REST" && layerDef.resourceUrl ?
+ layerDef.resourceUrl.tile.template :
+ capabilities.operationsMetadata.GetTile.dcp.http.get,
name: layerDef.title,
style: style.identifier,
- matrixIds: matrixSet.matrixIds
+ matrixIds: matrixSet.matrixIds,
+ tileFullExtent: matrixSet.bounds
})
);
}
diff --git a/lib/OpenLayers/Layer/WMTS.js b/lib/OpenLayers/Layer/WMTS.js
index 54d6d55be0..970942e240 100644
--- a/lib/OpenLayers/Layer/WMTS.js
+++ b/lib/OpenLayers/Layer/WMTS.js
@@ -38,7 +38,10 @@ OpenLayers.Layer.WMTS = OpenLayers.Class(OpenLayers.Layer.Grid, {
/**
* APIProperty: url
- * {String} The base URL for the WMTS service. Must be provided.
+ * {String|Array(String)} The base URL or request URL template for the WMTS
+ * service. Must be provided. Array is only supported for base URLs, not
+ * for request URL templates. URL templates are only supported for
+ * REST .
*/
url: null,
@@ -416,39 +419,59 @@ OpenLayers.Layer.WMTS = OpenLayers.Class(OpenLayers.Layer.Grid, {
var center = bounds.getCenterLonLat();
var info = this.getTileInfo(center);
var matrixId = this.matrix.identifier;
+ var dimensions = this.dimensions, params;
if (this.requestEncoding.toUpperCase() === "REST") {
-
- // include 'version', 'layer' and 'style' in tile resource url
- var path = this.version + "/" + this.layer + "/" + this.style + "/";
-
- // append optional dimension path elements
- if (this.dimensions) {
- for (var i=0; i=0; --i) {
+ dimension = dimensions[i];
+ context[dimension] = params[dimension.toUpperCase()];
}
}
- }
-
- // append other required path elements
- path = path + this.matrixSet + "/" + this.matrix.identifier +
- "/" + info.row + "/" + info.col + "." + this.formatSuffix;
-
- if (OpenLayers.Util.isArray(this.url)) {
- url = this.selectUrl(path, this.url);
+ url = OpenLayers.String.format(template, context);
} else {
- url = this.url;
- }
- if (!url.match(/\/$/)) {
- url = url + "/";
- }
- url = url + path;
+ // include 'version', 'layer' and 'style' in tile resource url
+ var path = this.version + "/" + this.layer + "/" + this.style + "/";
+ // append optional dimension path elements
+ if (dimensions) {
+ for (var i=0; i