Extracting EXIF Lat/Long metadata from photos

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);
});

}

1 Like

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