Fix lazy-bug.

This commit is contained in:
Jeremy Calvert 2023-05-22 08:44:08 -07:00
parent 24d1f4f2f9
commit 693e4c30bf
1 changed files with 14 additions and 4 deletions

View File

@ -1,5 +1,9 @@
function convertDMSToDD([degrees, minutes, seconds]) { function convertDMSToDD([degrees, minutes, seconds], ref) {
return degrees + minutes / 60 + seconds / 3600; decimal_degrees = degrees + minutes / 60 + seconds / 3600;
if (ref == 'S' || ref == 'W') {
decimal_degrees = -decimal_degrees;
}
return decimal_degrees;
} }
function readURL(input) { function readURL(input) {
@ -23,8 +27,14 @@ function readURL(input) {
var allMetaData = EXIF.getAllTags(this); var allMetaData = EXIF.getAllTags(this);
var allMetaDataSpan = document.getElementById('allMetaDataSpan'); var allMetaDataSpan = document.getElementById('allMetaDataSpan');
// allMetaDataSpan.innerHTML = JSON.stringify(allMetaData, null, '\t'); // allMetaDataSpan.innerHTML = JSON.stringify(allMetaData, null, '\t');
var lat = convertDMSToDD(EXIF.getTag(this, 'GPSLatitude')); var lat = convertDMSToDD(
var long = -convertDMSToDD(EXIF.getTag(this, 'GPSLongitude')); // Negative because it's west longitude EXIF.getTag(this, 'GPSLatitude'),
EXIF.getTag(this, 'GPSLatitudeRef')
);
var long = convertDMSToDD(
EXIF.getTag(this, 'GPSLongitude'),
EXIF.getTag(this, 'GPSLongitudeRef')
);
$('#lat').val(lat); $('#lat').val(lat);
$('#long').val(long); $('#long').val(long);
console.log(`lat: ${lat}, long: ${long}`); console.log(`lat: ${lat}, long: ${long}`);