From 47ee984a56ffff6d2605cc56cf97360941ea93d6 Mon Sep 17 00:00:00 2001 From: Tor-Einar Skog <tor-einar.skog@nibio.no> Date: Mon, 20 Nov 2023 14:31:32 +0100 Subject: [PATCH] Completing zone layer --- .../map_applications/fireblight/index.html | 13 +++++++++++++ .../map_applications/fireblight/js/map.js | 17 ++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/map_applications/fireblight/index.html b/src/main/webapp/map_applications/fireblight/index.html index 9901e1eb..01639206 100755 --- a/src/main/webapp/map_applications/fireblight/index.html +++ b/src/main/webapp/map_applications/fireblight/index.html @@ -162,6 +162,12 @@ #legend ul li.apiary:before { background-color: #ffe05e; } #legend ul li.nursery:before { line-height: 1em; width: .5em; height: .5em;border: 3px dotted black; background-color: rgb(255, 127,127);} + /* The opacity of these background colors must equal that of the zoneLayer in OpenLayers (see map.js) */ + #legend ul li.bekjempelsesSone:before { background-color: rgb(255,120,0); opacity: 0.65; } + #legend ul li.paerebrannSone:before { background-color: rgb(255,0,0); opacity: 0.65; } + #legend ul li.forebyggendeSone:before { background-color: rgb(0,225,0); opacity: 0.65; } + #legend ul li.utenforSone:before { background-color: rgb(255,255,0); opacity: 0.65; } + /* Screen size adjustments */ @media (max-width: 500px) { @@ -285,6 +291,13 @@ <li class="apiary"><input type="checkbox" checked onclick="apiaryLayer.setVisible(this.checked);"/>Bigårdsplass</li> <li class="nursery"><input type="checkbox" checked onclick="nurseryPoisOverlay.setVisible(this.checked);"/>Planteskole</li> </ul> + <h3><input type="checkbox" onclick="zoneLayer.setVisible(this.checked);"/>Sonekart</h3> + <ul> + <li class="bekjempelsesSone">Bekjempelsessone</li> + <li class="paerebrannSone">Pærebrannsone</li> + <li class="forebyggendeSone">Forebyggende sone</li> + <li class="utenforSone">Ingen tiltak</li> + </ul> </div> diff --git a/src/main/webapp/map_applications/fireblight/js/map.js b/src/main/webapp/map_applications/fireblight/js/map.js index bd7bbe66..7e2cf928 100755 --- a/src/main/webapp/map_applications/fireblight/js/map.js +++ b/src/main/webapp/map_applications/fireblight/js/map.js @@ -1,5 +1,5 @@ // The globally available map objects -var map, featureOverlay, newFeatureOverlay, nurseryPoisOverlay, apiaryLayer;//, apiaryPoisOverlay; +var map, featureOverlay, newFeatureOverlay, nurseryPoisOverlay, apiaryLayer, zoneLayer;//, apiaryPoisOverlay; // Override localization settings for this particular web page var hardcodedLanguage = "nb"; @@ -197,6 +197,19 @@ async function initMap() visible: true, opacity: 1.0 }); + + let zoneSource = new ol.source.ImageWMS({ + url: 'https://wms04test.nibio.no/cgi-bin/parebrann', + params: {"LAYERS":"parebrann"}, + ratio: 1, + projection: ol.proj.get("EPSG:25833") + }); + + zoneLayer = new ol.layer.Image({ + source: zoneSource, + visible: false, + opacity: 0.65 + }); map = new ol.Map({ target: 'map', @@ -204,10 +217,12 @@ async function initMap() //topo2graatone, topo4, //osm, + zoneLayer, nurseryPoisOverlay, //apiaryPoisOverlay, apiaryLayer, featureOverlay, + newFeatureOverlay ], view: new ol.View({ -- GitLab