diff --git a/js/wtracks.js b/js/wtracks.js index 8f9d9a5..8507865 100644 --- a/js/wtracks.js +++ b/js/wtracks.js @@ -2061,8 +2061,9 @@ $(function(){ var overlays = {}; var baseLayer = getVal("wt.baseLayer", config.display.map); var requestedMap = getParameterByName("map") + var requestedOverlays = (getParameterByName("overlays") || "").split(',') mapsForEach(function(name, props) { - if (props.on || name === requestedMap || name == baseLayer) { + if (props.on || name == baseLayer || name === requestedMap || requestedOverlays.includes(name)) { var inList = props.in == MAP_MY ? mymaps : config.maps; var tile = getProvider(inList[name]); if (tile) { @@ -2176,17 +2177,26 @@ $(function(){ .remove() } - objectForEach(overlaysOn, function(oname, oon) { - var ovl = overlays[oname]; - if (ovl) { - if (oon) { + if (requestedOverlays) { + requestedOverlays.forEach(function(oname) { + var ovl = overlays[oname]; + if (ovl) { map.addLayer(ovl); } - } else { - // doesn't exist anymore, delete it - setOverlay(oname, undefined); - } - }); + }); + } else { + objectForEach(overlaysOn, function(oname, oon) { + var ovl = overlays[oname]; + if (ovl) { + if (oon) { + map.addLayer(ovl); + } + } else { + // doesn't exist anymore, delete it + setOverlay(oname, undefined); + } + }); + } map.on("overlayadd", function(e) { ga('send', 'event', 'map', 'overlay', e.name);