From 9025a31ca5e6a24b07e86bc77778ce02e3e95172 Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@nibio.no>
Date: Fri, 14 Feb 2025 08:33:43 +0100
Subject: [PATCH] Feat: Add more zoom to the location finder

---
 src/main/webapp/map_applications/phytophthora/index.html | 2 +-
 src/main/webapp/map_applications/phytophthora/js/map.js  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/webapp/map_applications/phytophthora/index.html b/src/main/webapp/map_applications/phytophthora/index.html
index af52204e..0b2f644a 100755
--- a/src/main/webapp/map_applications/phytophthora/index.html
+++ b/src/main/webapp/map_applications/phytophthora/index.html
@@ -309,7 +309,7 @@
                     // If the first coordinate is > 32, it must be the latitude, since max longitude for Norway is 31-something
                     let longitude = parseFloat(lonLat[0]) > 32 ? lonLat[1] : lonLat[0];
                     let latitude = parseFloat(lonLat[0]) > 32 ? lonLat[0] : lonLat[1];
-                    navigateTo([parseFloat(longitude), parseFloat(latitude)]);
+                    navigateTo([parseFloat(longitude), parseFloat(latitude)], 18);
                     return;
                 }
                 $.getJSON( "https://ws.geonorge.no/stedsnavn/v1/navn?sok=" + phrase + "*&utkoordsys=4326&treffPerSide=6&side=1&filtrer=navn.skrivem%C3%A5te%2Cnavn.navneobjekttype%2Cnavn.kommuner%2Cnavn.representasjonspunkt", renderResults);
diff --git a/src/main/webapp/map_applications/phytophthora/js/map.js b/src/main/webapp/map_applications/phytophthora/js/map.js
index 25e3a976..88585a60 100755
--- a/src/main/webapp/map_applications/phytophthora/js/map.js
+++ b/src/main/webapp/map_applications/phytophthora/js/map.js
@@ -647,11 +647,11 @@ var unFocusForm = function () {
     newFeatureOverlay.getSource().clear();
 }
 
-var navigateTo = function (center) {
+var navigateTo = function (center, preferredZoom) {
     var centerPosition = ol.proj.transform(center, 'EPSG:4326', 'EPSG:3857');
     view = new ol.View({
         center: centerPosition,
-        zoom: 16
+        zoom: preferredZoom != undefined ? preferredZoom : 16
     });
 
     map.setView(view);
-- 
GitLab