From da613f84f2da389466fcba5db6b75a00b5707bd8 Mon Sep 17 00:00:00 2001 From: Lene Wasskog <lene.wasskog@nibio.no> Date: Wed, 5 Mar 2025 13:55:48 +0100 Subject: [PATCH] fix: Ensure layers are removed before map init --- spatial/static/spatial/js/gridmap.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spatial/static/spatial/js/gridmap.js b/spatial/static/spatial/js/gridmap.js index af00dc7..905db63 100644 --- a/spatial/static/spatial/js/gridmap.js +++ b/spatial/static/spatial/js/gridmap.js @@ -179,6 +179,7 @@ async function initGridMap(inputModelId, wmsURL, year, mapAttribution) { map.setTarget(null); } WMSLayersDateBucket = {}; + layers = []; timestamps = undefined; todayLayerIndex = undefined; document.getElementById("paramselector").style.display="block"; @@ -388,7 +389,7 @@ async function initGridMap(inputModelId, wmsURL, year, mapAttribution) { } popup = new ol.Overlay({ - element: document.getElementById('popup') + element: document.getElementById('popup') }); map.addOverlay(popup); @@ -396,6 +397,7 @@ async function initGridMap(inputModelId, wmsURL, year, mapAttribution) { displayQueryResult(evt); }); + // Store user's zoom/pan preferences for the next browser session map.on('moveend', (evt) => { // Store map settings -- GitLab