From 174b25f35cb7844de8a51254713ff2d66f10a021 Mon Sep 17 00:00:00 2001 From: Matthew McEachen Date: Mon, 13 Feb 2023 10:38:28 -0800 Subject: [PATCH] fix for issue #131: GPS lat/lon refs --- package.json | 4 ++-- src/WriteTask.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a1329d15..7b5b4a38 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,7 @@ "luxon": "^3.2.1" }, "optionalDependencies": { - "exiftool-vendored.exe": "12.50.0", - "exiftool-vendored.pl": "12.50.0" + "exiftool-vendored.exe": "12.56.0", + "exiftool-vendored.pl": "12.56.0" } } diff --git a/src/WriteTask.ts b/src/WriteTask.ts index bd69ce32..29e1f174 100644 --- a/src/WriteTask.ts +++ b/src/WriteTask.ts @@ -92,6 +92,17 @@ export class WriteTask extends ExifToolTask { return new VersionTask() as any } + // Special handling for GPSLatitude and GPSLongitude (due to differences + // in EXIF, XMP, and MIE encodings). See + // https://exiftool.org/forum/index.php?topic=14488.0 and + // https://github.com/photostructure/exiftool-vendored.js/issues/131 + if (isNumber(tags.GPSLatitude)) { + tags.GPSLatitudeRef ??= tags.GPSLatitude >= 0 ? "N" : "S" + } + if (isNumber(tags.GPSLongitude)) { + tags.GPSLongitudeRef ??= tags.GPSLongitude >= 0 ? "E" : "W" + } + for (const key of keys(tags)) { const val = tags[key] args.push(`-${key}=${enc(val)}`)