Closed sbellver closed 5 years ago
Anyone else with this issue?
`Ionic:
ionic (Ionic CLI) : 4.5.0 (/usr/local/lib/node_modules/ionic) Ionic Framework : @ionic/angular 4.0.0-beta.13 @angular-devkit/build-angular : 0.9.0-beta.3 @angular-devkit/schematics : 0.9.0-beta.3 @angular/cli : 6.2.6 @ionic/angular-toolkit : 1.0.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1) Cordova Platforms : android 7.1.4, ios 4.5.5 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.5, (and 12 other plugins)
System:
ios-deploy : 1.9.4 NodeJS : v10.11.0 (/usr/local/Cellar/node/10.11.0/bin/node) npm : 6.4.1 OS : macOS Mojave Xcode : Xcode 10.1 Build version 10B61`
I have encountered this issue myself today, I can see in the Android logs when running on a device the following message:
W/ExifInterface: Skip the tag entry since tag number is not defined: 2
Other than that there are no exceptions apart from this around the time of taking a photo: "ERROR", source: http://localhost/build/vendor.js (2086)
, which doesn't tell me anything.
Logging the metadata to the console console.log('Metadata:', JSON.stringify(metadata));
yields nothing other than [INFO:CONSOLE(2106)] "Metadata:", source: http://localhost/build/main.js (2106)
.
$ ionic info
Ionic:
ionic (Ionic CLI) : 4.10.2 (/.../.nvm/versions/node/v8.15.0/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.3
@ionic/app-scripts : 3.2.2
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 13 other plugins)
System:
Android SDK Tools : 26.1.1 (/.../Library/Android/sdk)
ios-deploy : 1.9.4
NodeJS : v8.15.0 (/.../.nvm/versions/node/v8.15.0/bin/node)
npm : 6.4.1
OS : macOS High Sierra
Xcode : Xcode 10.1 Build version 10B61
@sbellver probably a bit late for you but I've found the fix, the EXIF data comes back a bit funky for Android, in DMS instead of decimal like on iOS.
You need to convert it doing something like follows:
convertDmsToDd(stringDMS): number {
var DMS = stringDMS.split(",");
return this.EXIFdivide(DMS[0]) + (this.EXIFdivide(DMS[1]) / 60) + (this.EXIFdivide(DMS[2]) / 3600);
};
EXIFdivide(dStr): number {
let num = dStr.split('/');
return num[0] / num[1];
}
let lat = this.convertDmsToDd(metadata.gpsLatitude);
let lon = this.convertDmsToDd(metadata.gpsLongitude);
let latRef = metadata.gpsLatitudeRef;
let lonRef = metadata.gpsLongitudeRef;
// Remember to set the correct sign for values in S W.
lat = latRef == "S" ? lat * -1 : lat,
lon = lonRef == "W" ? lat * -1 : lon
Thanks Simon!
El 11 feb 2019, a las 3:52, Simon Brazell notifications@github.com escribió:
@sbellver https://github.com/sbellver probably a bit late for you but I've found the fix, the EXIF data comes back a bit funky for Android, in DMS instead of decimal like on iOS.
You need to convert it doing something like follows:
convertDmsToDd(stringDMS): number { var DMS = stringDMS.split(","); return this.EXIFdivide(DMS[0]) + (this.EXIFdivide(DMS[1]) / 60) + (this.EXIFdivide(DMS[2]) / 3600); };
EXIFdivide(dStr): number { let num = dStr.split('/'); return num[0] / num[1]; }
let lat = this.convertDmsToDd(metadata.gpsLatitude); let lon = this.convertDmsToDd(metadata.gpsLongitude); let latRef = metadata.gpsLatitudeRef; let lonRef = metadata.gpsLongitudeRef;
// Remember to set the correct sign for values in S W. lat = latRef == "S" ? lat -1 : lat, lon = lonRef == "W" ? lat -1 : lon — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/remoorejr/cordova-plugin-camera-with-exif/issues/38#issuecomment-462207776, or mute the thread https://github.com/notifications/unsubscribe-auth/AHsVmN3uYp0rIfD4KkzrZRKWXXRP07bTks5vMNrogaJpZM4ZA3vn.
Hi all.
We are using this plugin for ionic and works fine for iOS .
But in Android json_metadata only returns file path, not a JSON
`this.camera.getPicture(options).then((imageData: string) => { var thisResult = JSON.parse(imageData); var metadata = JSON.parse(thisResult.json_metadata);
var metadata = JSON.parse(thisResult.json_metadata) works fine on iOS, but stopped the app in Android