From 6acaff17a075ab622bf6876520b3565e5aa3a794 Mon Sep 17 00:00:00 2001 From: Heliane Ly Date: Fri, 1 Sep 2017 16:43:59 +0200 Subject: [PATCH] convert from DMSRational to Decimal Degree Lat Long --- piexif.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/piexif.js b/piexif.js index 343bf39..c8b61dc 100644 --- a/piexif.js +++ b/piexif.js @@ -2455,6 +2455,15 @@ SOFTWARE. var sec = Math.round(secFloat * 100); return [[deg, 1], [min, 1], [sec, 100]]; + }, + + dmsRationalToDeg:function (dmsArray, ref) { + var sign = (ref === 'S' || ref === 'W') ? -1.0 : 1.0; + var deg = sign * dmsArray[0][0] / dmsArray[0][1] + + dmsArray[1][0] / dmsArray[1][1] / 60.0 + + dmsArray[2][0] / dmsArray[2][1] / 3600.0; + + return deg; } };