From 6fe6da745739b65c97448d10ef0263f38c6c772f Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@nibio.no>
Date: Tue, 6 Aug 2024 09:02:56 +0200
Subject: [PATCH] Update WMS source for background map (Norway)

---
 src/components/CommonUtil.vue               | 2 +-
 src/components/MapObservation.vue           | 6 ++----
 src/components/MapObservationTimeSeries.vue | 5 ++---
 src/components/MapPOI.vue                   | 7 ++-----
 4 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/components/CommonUtil.vue b/src/components/CommonUtil.vue
index 8162f24..90b7e77 100644
--- a/src/components/CommonUtil.vue
+++ b/src/components/CommonUtil.vue
@@ -68,7 +68,7 @@
 
 		CONST_URL_STATIC_IMAGE_PATH: '/static/images/observations/',
 
-		CONST_GPS_URL_NORWAY_MAP: 'https://opencache.statkart.no/gatekeeper/gk/gk.open_wmts?Version=1.0.0&service=wmts&request=getcapabilities',
+		CONST_GPS_URL_NORWAY_MAP: 'https://cache.kartverket.no/v1/wmts/1.0.0/WMTSCapabilities.xml',
 		CONST_GPS_DEFAULT_LATITUDE_NORWAY: 16,
 		CONST_GPS_DEFAULT_LONGITUDE_NORWAY: 63,
 
diff --git a/src/components/MapObservation.vue b/src/components/MapObservation.vue
index 08bd87f..0ef31a4 100644
--- a/src/components/MapObservation.vue
+++ b/src/components/MapObservation.vue
@@ -226,12 +226,10 @@ export default {
           let result = parser.read(text);
 
           let options = optionsFromCapabilities(result, {
-            layer: 'topo4',
-            matrixSet: 'EPSG:3857',
+            layer: 'topo',
+            matrixSet: 'webmercator',
           });
           //CommonUtil.logInfo(options);
-          // Need to force https on the tiles URL (bug in the service?)
-          options.urls[0] = options.urls[0].replace("http", "https");
 
           This.myMap = new Map({
             layers: [
diff --git a/src/components/MapObservationTimeSeries.vue b/src/components/MapObservationTimeSeries.vue
index 15f044f..d061bb1 100644
--- a/src/components/MapObservationTimeSeries.vue
+++ b/src/components/MapObservationTimeSeries.vue
@@ -147,10 +147,9 @@ export default {
             let result = parser.read(text);
 
             let options = optionsFromCapabilities(result, {
-              layer: 'topo4',
-              matrixSet: 'EPSG:3857',
+              layer: 'topo',
+              matrixSet: 'webmercator',
             });
-            options.urls[0] = options.urls[0].replace("http","https");
 
             This.myMap = new Map({
               layers: [
diff --git a/src/components/MapPOI.vue b/src/components/MapPOI.vue
index 1d4b356..699442d 100644
--- a/src/components/MapPOI.vue
+++ b/src/components/MapPOI.vue
@@ -416,13 +416,10 @@
 						let parser = new WMTSCapabilities();
 						var result = parser.read(text);
 						var options = optionsFromCapabilities(result, {
-							layer: 'topo4',
-							matrixSet: 'EPSG:3857',
+							layer: 'topo',
+							matrixSet: 'webmercator',
 						});
 
-						// Need to force https on the tiles URL (bug in the service?)
-						options.urls[0] = options.urls[0].replace("http","https");
-
 						This.map = new Map({
 							layers: [
 								new TileLayer({
-- 
GitLab