Closed agnoam closed 3 years ago
Hey, I'm trying to get from images the latitude and longitude coordinates from images.
I succeed to implement something, but apperntly it's not working all the time:
Map<String, double> _convertToLatLng(List lat, String latRef, List long, String longRef) { try { if (lat == null || latRef == null || long == null || longRef == null) return {}; double latitude; double longitude; if (latRef == 'N') latitude = _convertToDegree(int.tryParse(lat[0].toString()), int.tryParse(lat[1].toString()), lat[2].toString()); else latitude = 0 - _convertToDegree(int.tryParse(lat[0].toString()), int.tryParse(lat[1].toString()), lat[2].toString()); if (longRef == 'E') longitude = _convertToDegree(int.tryParse(long[0].toString()), int.tryParse(long[1].toString()), long[2].toString()); else longitude = 0 - _convertToDegree(int.tryParse(long[0].toString()), int.tryParse(long[1].toString()), long[2].toString()); return { 'latitude': latitude, 'longitude': longitude }; } catch(ex) { print('_convertToLatLng ex: $ex'); return {}; } } double _convertToDegree(int deg, int min, String secondsFormula) { final List<String> strSeconds = secondsFormula.split('/'); final double seconds = int.tryParse(strSeconds[0]) / int.tryParse(strSeconds[1]); return deg + (min / 60) + (seconds / 3600); }
Do I miss something ?
see example/gps_coords.dart
Hey, I'm trying to get from images the latitude and longitude coordinates from images.
I succeed to implement something, but apperntly it's not working all the time:
Do I miss something ?