Prepare usage of basemap.at.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Sun, 3 Jan 2021 22:20:23 +0000 (23:20 +0100)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Sun, 3 Jan 2021 22:20:23 +0000 (23:20 +0100)
wrmap.js

index 1c11f50ad49e7a5a2727ad13647490e227a5940e..4e11557ca72379d99493664709c41f7fc815461d 100644 (file)
--- a/wrmap.js
+++ b/wrmap.js
@@ -37,11 +37,28 @@ function init_wrmap(i, jq_map) {
        // background layer
        // ----------------
 
        // background layer
        // ----------------
 
-       // OSM map
-       let layer_map = new ol.layer.Tile({
+       let layer_map;
+
+       // OSM layer
+       layer_map = new ol.layer.Tile({
                source: new ol.source.OSM()
        });
 
                source: new ol.source.OSM()
        });
 
+       // basemap.at layer  // TODO: Currently this is a race condition
+       let capabilitiesUrl = 'https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml';
+       fetch(capabilitiesUrl).then(function(response) {
+               return response.text();
+       }).then(function(text) {
+               let result = new ol.format.WMTSCapabilities().read(text);
+               let options = ol.source.WMTS.optionsFromCapabilities(result, {
+                       layer: 'geolandbasemap',
+                       matrixSet: 'google3857',
+                       style: 'normal',
+               });
+               layer_map = new ol.layer.Tile({
+                       source: new ol.source.WMTS(options),
+               });
+       });
 
        /*
        // Microsoft Bing Maps
 
        /*
        // Microsoft Bing Maps
@@ -51,7 +68,7 @@ function init_wrmap(i, jq_map) {
        //      tileOptions: {crossOriginKeyword: null}});
 
        // // Alternative: Base map
        //      tileOptions: {crossOriginKeyword: null}});
 
        // // Alternative: Base map
-       // // see: http://www.basemap.at
+       // // see: https://www.basemap.at
        
        // // Alternative: OpenTopoMap
        // // see: https://opentopomap.org/about
        
        // // Alternative: OpenTopoMap
        // // see: https://opentopomap.org/about