From 7a1e13f74e1fcb40f346cb0154699b6441fe92e0 Mon Sep 17 00:00:00 2001
From: Lene Wasskog <lene.wasskog@nibio.no>
Date: Mon, 20 Jan 2025 08:34:24 +0100
Subject: [PATCH] fix: Errors when editing weather station and poi
 [VIPSUTV-945]

---
 src/main/webapp/css/vipslogic.css           | 2 +-
 src/main/webapp/js/poiFormMap.js            | 2 ++
 src/main/webapp/js/weatherStationFormMap.js | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/main/webapp/css/vipslogic.css b/src/main/webapp/css/vipslogic.css
index 0ce019c9..7e1bd4ad 100755
--- a/src/main/webapp/css/vipslogic.css
+++ b/src/main/webapp/css/vipslogic.css
@@ -250,7 +250,7 @@ legend {
     display: block;
 }
 
-#objectGISInfoMap, #weatherStationListMap, #weatherStationFormMap, #weatherStationViewMap, #poiListMap {
+#objectGISInfoMap, #weatherStationListMap, #weatherStationFormMap, #weatherStationViewMap, #poiListMap, #poiFormMap {
     height: 400px;
     width: 100%;
 }
diff --git a/src/main/webapp/js/poiFormMap.js b/src/main/webapp/js/poiFormMap.js
index 2e9f8572..acbec313 100755
--- a/src/main/webapp/js/poiFormMap.js
+++ b/src/main/webapp/js/poiFormMap.js
@@ -71,6 +71,8 @@ function initMap(center, zoomLevel, organizationId, currentPoiId, readOnly)
                     })
     });
 
+    const centerPosition = ol.proj.transform(center, 'EPSG:4326', map.getView().getProjection().getCode());
+
     // Marker overlay
     stationMarker = new ol.Overlay({
       position: currentPoiId !== null ? centerPosition : undefined,
diff --git a/src/main/webapp/js/weatherStationFormMap.js b/src/main/webapp/js/weatherStationFormMap.js
index 235080fc..7f97e872 100755
--- a/src/main/webapp/js/weatherStationFormMap.js
+++ b/src/main/webapp/js/weatherStationFormMap.js
@@ -70,6 +70,8 @@ function initMap(center, zoomLevel, organizationId, currentWeatherStationId)
                     })
     });
 
+    const centerPosition = ol.proj.transform(center, 'EPSG:4326', map.getView().getProjection().getCode());
+
     // Marker overlay
     stationMarker = new ol.Overlay({
       position: currentWeatherStationId !== null ? centerPosition : undefined,
-- 
GitLab