Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var exif = new ExifInterface(App._file.AbsolutePath);
- string lon = ExifInterface.TagGpsLongitude;
- string lon_data = exif.GetAttribute(lon);
- longitude_coord = FormatAsCoordinate(lon_data);
- string lat = ExifInterface.TagGpsLatitude;
- string lat_data = exif.GetAttribute(lat);
- latitude_coord = FormatAsCoordinate(lat_data);
- public string FormatAsCoordinate(string unformattedCoordinate)
- {
- if (string.IsNullOrEmpty(unformattedCoordinate))
- return "";
- else
- {
- char divider = '/';
- char divider2 = ',';
- var strings = unformattedCoordinate.Split(divider);
- var strings1 = strings[1].Split(divider2);
- var strings2 = strings[2].Split(divider2);
- var numSeconds = (Convert.ToDouble(strings1[1]) * 60 + Convert.ToDouble(strings2[1]));
- double seconds = 0;
- try
- {
- seconds = numSeconds / 3600;
- seconds = Math.Round(seconds, 6, MidpointRounding.AwayFromZero);
- }
- catch
- {
- seconds = 0;
- }
- var coordinate = (Convert.ToDouble(strings[0])) + seconds;
- return (coordinate - 1).ToString();
- }
- }
Add Comment
Please, Sign In to add comment