HexapiBackground.GpsExtensions.Latitude2Double C# (CSharp) Method

Latitude2Double() static private method

static private Latitude2Double ( this lat, string ns ) : double
lat this
ns string
return double
        internal static double Latitude2Double(this string lat, string ns)
        {
            if (lat.Length < 2 || string.IsNullOrEmpty(ns))
                return 0;

            var med = 0d;

            if (!double.TryParse(lat.Substring(2), out med))
                return 0d;

            med = med / 60.0d;

            var temp = 0d;

            if (!double.TryParse(lat.Substring(0, 2), out temp))
                return 0d;

            med += temp;

            if (ns.StartsWith("S"))
            {
                med = -med;
            }

            return Math.Round(med, 8);
        }