From d8e32569428229ac5ea5156a34f26a5755f61e68 Mon Sep 17 00:00:00 2001 From: Tor-Einar Skog <tor-einar.skog@nibio.no> Date: Fri, 10 Nov 2023 10:27:55 +0100 Subject: [PATCH] Bugfix: Adapt projections to current layer's projection --- spatial/static/spatial/js/gridmap.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spatial/static/spatial/js/gridmap.js b/spatial/static/spatial/js/gridmap.js index 25112a19..10fb6a76 100644 --- a/spatial/static/spatial/js/gridmap.js +++ b/spatial/static/spatial/js/gridmap.js @@ -197,8 +197,8 @@ msLoadMap(): Unable to access file. (/disks/data01/mapserver/wms/SEPTREFFUM/SEPT // If the current WMS layer has a lot of no-data / invisible values surrounding the // visible values, the zoom might appear to be a bit too far out let currentWMSLayer = WMSLayersDateBucket[currentTimestamp][currentParameter] - let WMSExtent = currentWMSLayer.EX_GeographicBoundingBox; // Assuming this is always EPSG:4326??? - let extent = ol.proj.transformExtent(WMSExtent, 'EPSG:4326', map.getView().getProjection()); + let WMSExtent = currentWMSLayer.EX_GeographicBoundingBox; + let extent = ol.proj.transformExtent(WMSExtent, getCurrentVisibleOLLayer().getSource().getProjection().getCode(), map.getView().getProjection()); map.getView().fit(extent, map.getSize()); popup = new ol.Overlay({ @@ -230,7 +230,7 @@ async function displayQueryResult(evt) let popupElement = popup.getElement(); $(popupElement).popover('destroy'); - let coordinate = proj4(map.getView().getProjection().getCode(), 'EPSG:4326', evt.coordinate) + let currentWMSLayer = WMSLayersDateBucket[currentTimestamp][currentParameter]; // Need to get all layers for today, and combine results from querying all layers @@ -240,6 +240,7 @@ async function displayQueryResult(evt) for(let i=0;i<layersForCurrentTimestamp.length;i++) { let currentLayer = layersForCurrentTimestamp[i]; + let coordinate = proj4(map.getView().getProjection().getCode(), currentLayer.getSource().getProjection().getCode(), evt.coordinate) const url = currentLayer.getSource().getGetFeatureInfoUrl( coordinate, map.getView().getResolution(), -- GitLab