Skip to content

Commit a8d9db5

Browse files
authored
fix(map): GPS coordinate hemisphere inversion bug (#84)
1 parent 64b4677 commit a8d9db5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

apps/web/src/lib/map-utils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,13 @@ export function convertExifGPSToDecimal(exif: PickedExif | null): {
5252
? GPSDirection.West
5353
: GPSDirection.East
5454

55-
// Apply reference direction to coordinates
56-
if (latitudeRef === GPSDirection.South) {
55+
// Apply reference direction to coordinates only if they're positive
56+
// Some EXIF tools already provide properly signed coordinates
57+
if (latitudeRef === GPSDirection.South && latitude > 0) {
5758
latitude = -latitude
5859
}
5960

60-
if (longitudeRef === GPSDirection.West) {
61+
if (longitudeRef === GPSDirection.West && longitude > 0) {
6162
longitude = -longitude
6263
}
6364

0 commit comments

Comments
 (0)