Hi all,
I am trying to convert the QPSLOC entry from the router page to decimal degress. But I am failing. Here’s the regex I use and my calculation:
const [, latitudeDeg, latitudeMin, latitudeSec, latitudeDir, longitudeDeg, longitudeMin, longitudeSec, longitudeDir] = gpsData.match(/(\d{2})(\d{2}).(\d+)([NS]),(\d{3})(\d{2}).(\d+)([EW])/);
const latitudeDecimal = parseFloat(latitudeDeg) + parseFloat(latitudeMin) / 60 + (parseFloat(latitudeSec)) / 3600;
const longitudeDecimal = parseFloat(longitudeDeg) + parseFloat(longitudeMin) / 60 + (parseFloat(longitudeSec)) / 3600;
I get close if I do not devide what I think should be the minutes by 60 (then it is the exact value). But for seconds, I have no idea on how to get the correct value.
Any pointer as to where my calculation is wrong, would be highly appreciated!
Best