/* * Yubeshi GPS Parser * * This software is distributed under a zlib-style license. * See license.txt for more information. */ using System; using System.Collections.Generic; using System.Text; namespace Yubeshi { public class Coordinate { public Coordinate(string latitude, string ns, string longitude, string ew) { decimal latRaw = Decimal.Parse(latitude); decimal lngRaw = Decimal.Parse(longitude); decimal lat = Math.Floor(latRaw / 100m) + (latRaw % 100m) / 60m; decimal lng = Math.Floor(lngRaw / 100m) + (lngRaw % 100m) / 60m; Latitude = (ns == "S") ? -lat : lat; Longitude = (ns == "W") ? -lng : lng; } #region properties public decimal Latitude { get; set; } public decimal Longitude { get; set; } #endregion } }