Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

language: javascript proivde helper function that uses the parse-dms node package to convert the GPSLatitude and GPSLongitude into degrees rather than DMS. const imageBucket =

language: javascript

proivde helper function that uses the parse-dms node package to convert the GPSLatitude and GPSLongitude into degrees rather than DMS.


const imageBucket = storage.bucket(photo.bucket);

//Create a working directory
const workingDir = path.join(os.tmpdir(), 'exif');
const tmpFilePath = path.join(workingDir, photo.name);

//Wait until the temp directory is ready
await fs.ensureDir(workingDir);

//Download file to temp directory
await imageBucket.file(photo.name).download ({
destination: tmpFilePath
});

try {
//call our helper function that getx EXIF from the local file.
getExif(tmpFilePath);
} catch(error){
console.log('Error: ' + error.message);
}

// clean Up
await fs. remove(workingDir);
return true;

};

// helper functions
function getExif(tempImage) {
new ExifImage(
{ image : tempImage},
function (error, exifData) {
if (error)
console.log('Error: ' + error.message);
else
//cal helper function that writes EXIF data to the log
logExif(exifData);
}
)
}

function logExif(data) {

console.log(data.gps.GPSLatitude[0]);
console.log(data.gps.GPSLatitude[1]);
console.log(data.gps.GPSLatitude[2]);
console.log(data.gps.GPSLongitude[0]);
console.log(data.gps.GPSLongitude[1]);
console.log(data.gps.GPSLongitude[2]);

};


Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mastering Real Time Analytics In Big Data A Comprehensive Guide For Everyone

Authors: Lennox Mark

1st Edition

B0CPTC9LY9, 979-8869045706

More Books

Students also viewed these Databases questions

Question

hi I need to fill out this form for a bakery project

Answered: 1 week ago