Extracting EXIF Lat/Long metadata from photos


#1

How can I extract EXIF metadata like lat/long from a photo?

This is the code I’m using with the camera plugin :

doGetPicture() {
// TODO:
// get picture from camera
Camera.getPicture({
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.CAMERA,
encodingType: Camera.EncodingType.JPEG,
targetHeight: 640,
saveToPhotoAlbum: true,
allowEdit: true,
correctOrientation: true
}).then((_imagePath) => {
alert('got image path ’ + _imagePath);
return this.makeFileIntoBlob(_imagePath);
}).then((_imageBlob) => {
alert('got image blob ’ + _imageBlob);
return this.uploadToFirebase(_imageBlob);
}).then((_uploadSnapshot: any) => {
alert('file uploaded successfully ’ + _uploadSnapshot.downloadURL);
// store reference to storage in database
return this.saveToDatabaseAssetList(_uploadSnapshot);
}).then((_uploadSnapshot: any) => {
alert('file saved to asset catalog successfully ');
this.nav.push(ReviewPage);
}, (_error) => {
alert('Error ’ + _error.message);
});

}

To pick photo from photo gallery, I’m using ImagePicker Plugin :
pickGallery(){
let options = {
maximumImagesCount: 1,
width: 800,
height: 800,
quality: 75
}
ImagePicker.getPictures(options).then((result) => {
alert('got image path ’ + result);
return this.makeFileIntoBlob(result[0]);
}).then((_imageBlob) => {
alert('got image blob ’ + _imageBlob);
return this.uploadToFirebase(_imageBlob);
}).then((_uploadSnapshot: any) => {
alert('file uploaded successfully ’ + _uploadSnapshot.downloadURL);
// store reference to storage in database
return this.saveToDatabaseAssetList(_uploadSnapshot);
}).then((_uploadSnapshot: any) => {
alert('file saved to asset catalog successfully ');
this.nav.push(ReviewPage);
}, (_error) => {
alert('Error ’ + _error.message);
});

}


#2

use https://github.com/remoorejr/cordova-plugin-camera-with-exif