Move layer_map down in source code.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Tue, 5 Jan 2021 19:53:01 +0000 (20:53 +0100)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Tue, 5 Jan 2021 19:53:01 +0000 (20:53 +0100)
wrmap.js

index 4e11557ca72379d99493664709c41f7fc815461d..456f22963009cc7a7a0f39b44fddd9a345d72058 100644 (file)
--- a/wrmap.js
+++ b/wrmap.js
@@ -34,51 +34,6 @@ function init_wrmap(i, jq_map) {
        let features_all = format_geojson.readFeatures(json_js, {dataProjection: EPSG4326, featureProjection: EPSG3857});
 
 
        let features_all = format_geojson.readFeatures(json_js, {dataProjection: EPSG4326, featureProjection: EPSG3857});
 
 
-       // background layer
-       // ----------------
-
-       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
-       // let layer_map = new OpenLayers.Layer.Bing({
-       //      type: "Road",
-       //      key: "AgPH3SlIXAwajrJKf0FORQyhTqsP8KIlvtN6RKfvxe6fOB6q6-HFmg8EOFm7LSOA",
-       //      tileOptions: {crossOriginKeyword: null}});
-
-       // // Alternative: Base map
-       // // see: https://www.basemap.at
-       
-       // // Alternative: OpenTopoMap
-       // // see: https://opentopomap.org/about
-
-       // // Alternative: Dummy base layer
-       // let layer_map = new OpenLayers.Layer.Vector("Base Layer", {
-       //     isBaseLayer: true});
-       */
-
-
        // path layer
        // ----------
 
        // path layer
        // ----------
 
@@ -261,7 +216,6 @@ function init_wrmap(i, jq_map) {
        let map = new ol.Map({
                target: jq_map[0],
                layers: [
        let map = new ol.Map({
                target: jq_map[0],
                layers: [
-                       layer_map,
                        layer_sledrun
                ],
                overlays: [popup_overlay],
                        layer_sledrun
                ],
                overlays: [popup_overlay],
@@ -302,6 +256,49 @@ function init_wrmap(i, jq_map) {
                        }
                }
        });
                        }
                }
        });
+
+
+       // background layer
+       // ----------------
+
+       // OSM layer
+       let 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
+       // let layer_map = new OpenLayers.Layer.Bing({
+       //      type: "Road",
+       //      key: "AgPH3SlIXAwajrJKf0FORQyhTqsP8KIlvtN6RKfvxe6fOB6q6-HFmg8EOFm7LSOA",
+       //      tileOptions: {crossOriginKeyword: null}});
+
+       // // Alternative: Base map
+       // // see: https://www.basemap.at
+
+       // // Alternative: OpenTopoMap
+       // // see: https://opentopomap.org/about
+
+       // // Alternative: Dummy base layer
+       // let layer_map = new OpenLayers.Layer.Vector("Base Layer", {
+       //     isBaseLayer: true});
+
+       map.getLayers().insertAt(0, layer_map);
 }
 
 function init_wrmaps() {
 }
 
 function init_wrmaps() {
@@ -311,4 +308,3 @@ function init_wrmaps() {
 
 
 $(document).ready(init_wrmaps);
 
 
 $(document).ready(init_wrmaps);
-