public static double ToDouble(this DmsPoint point) { if (point == null) { return(default(double)); } var result = (double)Math.Abs(point.Degrees) + (double)point.Minutes / (double)60 + (double)point.Seconds / (double)3600; if (point.Degrees < 0) { return(result * (double)-1); } return(result); }
public DmsLocation ExtractDmsLocation(Dictionary <string, string> exifInfo) { exifInfo.TryGetValue(ExifTagNames.GPSLatitude, out string latInfo); exifInfo.TryGetValue(ExifTagNames.GPSLatitudeRef, out string latRef); exifInfo.TryGetValue(ExifTagNames.GPSLongitude, out string longInfo); exifInfo.TryGetValue(ExifTagNames.GPSLongitudeRef, out string longRef); if (!string.IsNullOrWhiteSpace(latInfo) && !string.IsNullOrWhiteSpace(latRef) && !string.IsNullOrWhiteSpace(longInfo) && !string.IsNullOrWhiteSpace(longRef)) { var lat = DmsPoint.ParseFromGps(latInfo, PointType.Lat, latRef); var lon = DmsPoint.ParseFromGps(longInfo, PointType.Lon, longRef); if (lat != null && lon != null) { return(new DmsLocation(lat, lon)); } } return(null); }
public DmsLocation(DmsPoint latitude, DmsPoint longitude) { Latitude = latitude; Longitude = longitude; }