From: Philipp Spitzer Date: Sun, 3 Jan 2021 22:20:23 +0000 (+0100) Subject: Prepare usage of basemap.at. X-Git-Url: https://git.toastfreeware.priv.at/philipp/winterrodeln/mediawiki_extensions/wrmap.git/commitdiff_plain/1217c25bb70c96fd76d53cd45fa1d53521000202?ds=inline Prepare usage of basemap.at. --- diff --git a/wrmap.js b/wrmap.js index 1c11f50..4e11557 100644 --- a/wrmap.js +++ b/wrmap.js @@ -37,11 +37,28 @@ function init_wrmap(i, jq_map) { // 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() }); + // 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 @@ -51,7 +68,7 @@ function init_wrmap(i, jq_map) { // tileOptions: {crossOriginKeyword: null}}); // // Alternative: Base map - // // see: http://www.basemap.at + // // see: https://www.basemap.at // // Alternative: OpenTopoMap // // see: https://opentopomap.org/about