diff --git a/src/mapml/layers/MapMLLayer.js b/src/mapml/layers/MapMLLayer.js
index b45895550..ca0ab49a4 100644
--- a/src/mapml/layers/MapMLLayer.js
+++ b/src/mapml/layers/MapMLLayer.js
@@ -886,7 +886,8 @@ export var MapMLLayer = L.Layer.extend({
}
for (var i=0;i< tlist.length;i++) {
- var t = tlist[i], template = t.getAttribute('tref');
+ var t = tlist[i], template = t.getAttribute('tref');
+ t.zoomInput = zoomInput;
if(!template){
template = BLANK_TT_TREF;
let blankInputs = mapml.querySelectorAll('map-input');
@@ -909,12 +910,13 @@ export var MapMLLayer = L.Layer.extend({
var varName = v[1],
inp = serverExtent.querySelector('map-input[name='+varName+'],map-select[name='+varName+']');
if (inp) {
-
+
if ((inp.hasAttribute("type") && inp.getAttribute("type")==="location") &&
- (!inp.hasAttribute("min" || !inp.hasAttribute("max"))) &&
+ (!inp.hasAttribute("min") || !inp.hasAttribute("max")) &&
(inp.hasAttribute("axis") && !["i","j"].includes(inp.getAttribute("axis").toLowerCase()))){
- zoomInput.setAttribute("value", extentFallback.zoom);
-
+ if (zoomInput && template.includes(`{${zoomInput.getAttribute('name')}}`)) {
+ zoomInput.setAttribute("value", extentFallback.zoom);
+ }
let axis = inp.getAttribute("axis"),
axisBounds = M.convertPCRSBounds(extentFallback.bounds, extentFallback.zoom, projection, M.axisToCS(axis));
inp.setAttribute("min", axisBounds.min[M.axisToXY(axis)]);
diff --git a/src/mapml/layers/TemplatedTileLayer.js b/src/mapml/layers/TemplatedTileLayer.js
index f3d06242b..14c178ab2 100644
--- a/src/mapml/layers/TemplatedTileLayer.js
+++ b/src/mapml/layers/TemplatedTileLayer.js
@@ -153,10 +153,15 @@ export var TemplatedTileLayer = L.TileLayer.extend({
!this._template.tilematrix.bounds[coords.z].contains(coords)) {
return '';
}
- var obj = {};
+ var obj = {},
+ linkEl = this._template.linkEl,
+ zoomInput = linkEl.zoomInput;
obj[this._template.tilematrix.col.name] = coords.x;
obj[this._template.tilematrix.row.name] = coords.y;
- obj[this._template.zoom.name] = this._getZoomForUrl();
+ if (zoomInput && (linkEl.hasAttribute('tref') &&
+ linkEl.getAttribute('tref').includes(`{${zoomInput.getAttribute('name')}}`))) {
+ obj[this._template.zoom.name] = this._getZoomForUrl();
+ }
obj[this._template.pcrs.easting.left] = this._tileMatrixToPCRSPosition(coords, 'top-left').x;
obj[this._template.pcrs.easting.right] = this._tileMatrixToPCRSPosition(coords, 'top-right').x;
obj[this._template.pcrs.northing.top] = this._tileMatrixToPCRSPosition(coords, 'top-left').y;
diff --git a/test/e2e/layers/templatedTileLayer.html b/test/e2e/layers/templatedTileLayer.html
index 5dbee58b8..92965357a 100644
--- a/test/e2e/layers/templatedTileLayer.html
+++ b/test/e2e/layers/templatedTileLayer.html
@@ -47,6 +47,16 @@
title="Canada Base Map © Natural Resources Canada">
+
+
+
+
+
+
+
+
+
+