diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2025-06-05 15:18:05 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2025-06-05 15:40:38 +0200 |
commit | 722fb24ab2cf606a60b34991bb4e6f36b7e8ec18 (patch) | |
tree | af26c28642d7720e52fa09a672f3441a77631676 /main.js | |
parent | 87a1bf0d5157a727984221d5d3507a4079e72ff4 (diff) |
Update default view.
Use Lantmäteriet's 'topowebb_nedtonad' basemap, and show some layers.
This is more or less what's being linked to at
https://www.klimatanalysnorr.se/kartor-2/ .
For existing links to the old non-hierarchical names, we simply use the
default view instead of trying to map layer names to the new ones.
Diffstat (limited to 'main.js')
-rw-r--r-- | main.js | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -119,7 +119,7 @@ const view = new View({ constrainResolution: false, }); -let baseMapLayer = 'topowebb'; +let baseMapLayer = 'topowebb_nedtonad'; (function() { const params = new URLSearchParams(window.location.hash.substring(1)); const x = parseFloat(params.get('x')); @@ -131,6 +131,33 @@ let baseMapLayer = 'topowebb'; if (!isNaN(z)) { view.setZoom(z); } + if (params.has('layers')) { + const layers = params.get('layers').split(' '); + if (layers.length > 0 && !layers.some((l) => l.includes('.'))) { + /* compat redirect/layer subst for old non-hierachical names */ + params.delete('layers'); + } + } + if (!params.has('layers')) { + params.set('layers', [ + 'svk.ledningar', + 'svk.stolpar', + 'svk.stationer', + 'svk.transmissionsnatsprojekt', + 'misc.gigafactories', + 'misc.dammar', + 'mrr.appr_ec', + 'mrr.appl_ec', + 'mrr.appr_ogd', + 'mrr.appl_ogd', + 'mrr.appr_met', + 'mrr.appl_met', + 'mrr.appr_dl', + 'vbk.area_current', + 'vbk.area_notcurrent', + ].join(' ')); + location.hash = '#' + params.toString(); + } if (params.has('basemap')) { baseMapLayer = params.get('basemap'); |