ExifReader
ExifReader copied to clipboard
exif-reader.d.ts's NumberArrayTag type for GPSLatitude & GPSLongitude should be number[][] rather than number[]
Description
Exif's GPSLatitude & GPSLongitude type definition should be number[][] rather than number[].
getCalculatedGpsValue expects each of its first 3 function parameters (degrees, minutes, seconds) to be a number[]
. Each parameter is based on value[0], value[1], and value[2]
of GPSLatitude & GPSLongitude. Thus the value
prop has a type of number[][]
.
Additional details
- ExifReader version: 4.21.1
- Web browser and version: chrome Version 123.0.6312.107 (Official Build) (arm64)
- Node version: N/A
- Can you reproduce the bug on the examples site? N/A
- I was trying to replicate the computation of the latitude and longitude based on GPSLatitude/GPSLongitude & GPSLatitudeRef/GPSLongitudeRef. The same computation that ExifReader's
getCalculatedGpsValue
performs. https://mattiasw.github.io/ExifReader/
- I was trying to replicate the computation of the latitude and longitude based on GPSLatitude/GPSLongitude & GPSLatitudeRef/GPSLongitudeRef. The same computation that ExifReader's
How to reproduce
-
Read the tags from an Android photo using the example site's ES module
-
Take the tags' GPSLatitude/GPSLongitude and pass it to a typescripted function akin to
getCalculatedGpsValue
such asgpsDMSToFloat(latLng: NumberArrayTag, latLngRef: StringArrayTag)
function gpsDMSToFloat(latLng: NumberArrayTag, latLngRef: StringArrayTag) { const latLngDeg = latLng.value[0]; const latLngMin = latLng.value[1]; const latLngSec = llatLng.value[2]; return (latLngDeg[0] / latLngDeg[1]) + (latLngMin[0] / latLngMin[1]) / 60 + (latLngSec[0] / latLngSec[1]) / 3600; }
-
Typescript error regarding
latLngDeg, latLngMin, latLngSec
What I expected would happen:
No typescript error associated with accessing value
of GPSLatitude/GPSLongitude in the manner shown above.
What really happened:
Typescript error regarding latLngDeg, latLngMin, latLngSec