mattiasw / ExifReader

A JavaScript Exif info parser.
Mozilla Public License 2.0
737 stars 88 forks source link

fileExif.exif.GPSLatitude value vs description #319

Closed BuZZ-dEE closed 3 months ago

BuZZ-dEE commented 3 months ago

Why is the value 52.66656111111111 in the property description for GPSLatitude? What is the value array representing? For GPSLatitudeRef it seems to be different.

fileExif.exif.GPSLatitude
{id: 2, value: Array(3), description: 52.66656111111111}
description: 52.66656111111111
id: 2
value: Array(3) [Array(2), Array(2), Array(2)]
0: Array(2) [52, 1]
1: Array(2) [39, 1]
2: Array(2) [5962, 100]
length: 3
__proto__: Array(0)
__proto__: {}
fileExif.exif.GPSLatitudeRef
{id: 1, value: Array(1), description: "North latitude"}
description: "North latitude"
id: 1
value: Array(1) ["N"]
__proto__: {}
mattiasw commented 3 months ago

Hi! The value array for GPSLatitude represents the latitude coordinate in degrees, minutes and seconds expressed as three rational numbers where the first item in each sub-array is the numerator and the second is the denominator. The description has this coordinate converted into a decimal number. To know whether the coordinate is on the northern or the southern hemisphere the GPSLatitudeRef is used (value can be either N or S).

It works the same for longitude and altitude.

To simplify the use of GPS coordinates, expanded: true can be passed in in the options object which will create a gps group in the result that automatically converts the numbers into positive or negative decimal numbers.

BuZZ-dEE commented 3 months ago

@mattiasw thx for clarification.