diff --git a/src/main/webapp/map_applications/phytophthora/index.html b/src/main/webapp/map_applications/phytophthora/index.html index 0005d51a1bfe87434eff4cd1b57586b0f13b33bf..af52204e4ca549b5c0b98021dc343c2bc7c97211 100755 --- a/src/main/webapp/map_applications/phytophthora/index.html +++ b/src/main/webapp/map_applications/phytophthora/index.html @@ -305,7 +305,11 @@ { // Call map functionality to center on coordinate const lonLat = phrase.split(","); - navigateTo([parseFloat(lonLat[0]), parseFloat(lonLat[1])]); + // Check if it's a lat-lon or a lon-lat coordinate (Specific for Norway!) + // 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)]); 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);