From 0a001d3c7d337a2838c3f2b7493d4a3b218fe9a5 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 10 Dec 2024 02:38:00 +0100 Subject: [PATCH] Fix: fix #2304 --- src/Logic/ImageProviders/Panoramax.ts | 6 ++++++ src/UI/Test.svelte | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/Logic/ImageProviders/Panoramax.ts b/src/Logic/ImageProviders/Panoramax.ts index c3ef71522..ad1be06d9 100644 --- a/src/Logic/ImageProviders/Panoramax.ts +++ b/src/Logic/ImageProviders/Panoramax.ts @@ -234,6 +234,12 @@ export class PanoramaxUploader implements ImageUploader { ) { lat = exifLat lon = exifLon + if(tags?.GPSLatitudeRef?.value?.[0] === "S"){ + lat *= -1 + } + if(tags?.GPSLongitudeRef?.value?.[0] === "W"){ + lon *= -1 + } } const [date, time] =( tags.DateTime.value[0] ?? tags.DateTimeOriginal.value[0] ?? tags.GPSDateStamp ?? tags["Date Created"]).split(" ") const exifDatetime = new Date(date.replaceAll(":", "-") + "T" + time) diff --git a/src/UI/Test.svelte b/src/UI/Test.svelte index 118013989..586400478 100644 --- a/src/UI/Test.svelte +++ b/src/UI/Test.svelte @@ -34,6 +34,9 @@ >tags?.GPSLongitude?.value const exifLat = latD + latM / 60 + latS / (3600 * latSDenom) const exifLon = lonD + lonM / 60 + lonS / (3600 * lonSDenom) + const directValueLat = tags?.GPSLatitude?.description + const directValueLon = tags?.GPSLongitude?.description + if ( typeof exifLat === "number" && !isNaN(exifLat) && @@ -43,11 +46,22 @@ ) { lat = exifLat lon = exifLon + if(tags?.GPSLatitudeRef?.value?.[0] === "S"){ + lat *= -1 + } + if(tags?.GPSLongitudeRef?.value?.[0] === "W"){ + lon *= -1 + } l("Using EXIFLAT + EXIFLON") } else { l("NOT using exifLat and exifLon: invalid value detected") } l("Lat and lon are", lat, lon) + l("ref lat is", tags?.GPSLatitudeRef?.description, JSON.stringify(tags?.GPSLatitudeRef?.value)) + l("ref lon is", tags?.GPSLongitudeRef?.description, JSON.stringify(tags?.GPSLongitudeRef?.value)) + + + l("Direct values are", directValueLat,directValueLon,"corrected:",lat,lon) l("Datetime value is", JSON.stringify(tags.DateTime)) const [date, time] = tags.DateTime.value[0].split(" ") datetime = new Date(date.replaceAll(":", "-") + "T" + time).toISOString()