From 3864d3aa3735727f22531b13be16d71200cff99a Mon Sep 17 00:00:00 2001 From: Paul Bailey Date: Sun, 16 Nov 2025 16:22:17 +0000 Subject: [PATCH] fix: correct EXIF GPS data extraction using exifr.gps() The previous implementation was using exifr.parse() with pick option, which doesn't work for GPS coordinates since latitude/longitude are computed values, not direct EXIF fields. Changed to use exifr.gps() method which properly extracts and computes GPS coordinates from EXIF GPSLatitude/GPSLongitude fields. This fixes the issue where photos with GPS EXIF data were showing 'No GPS data' in the UI. --- src/components/report/PhotoUpload.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/components/report/PhotoUpload.tsx b/src/components/report/PhotoUpload.tsx index 9829b84..cebd28c 100644 --- a/src/components/report/PhotoUpload.tsx +++ b/src/components/report/PhotoUpload.tsx @@ -32,18 +32,17 @@ export function PhotoUpload({ const extractEXIF = async (file: File): Promise> => { try { + // Parse GPS data separately to get computed latitude/longitude + const gpsData = await exifr.gps(file); + + // Parse other EXIF data for timestamp const exifData = await exifr.parse(file, { - gps: true, - pick: ['latitude', 'longitude', 'DateTimeOriginal', 'CreateDate'] + pick: ['DateTimeOriginal', 'CreateDate', 'DateTime'] }); - if (!exifData) { - return { hasGPS: false }; - } - - const latitude = exifData.latitude; - const longitude = exifData.longitude; - const timestamp = exifData.DateTimeOriginal || exifData.CreateDate; + const latitude = gpsData?.latitude; + const longitude = gpsData?.longitude; + const timestamp = exifData?.DateTimeOriginal || exifData?.CreateDate || exifData?.DateTime; return { latitude: latitude !== undefined ? latitude : undefined,