Ejemplo n.º 1
0
        //dsfsdfsdfsdf
        //sdfsdfs
        //sdfbsdfhjsd
        //dsjhfkdjs
        //sdjgfsdgjfgds
        //ksdhfhsdgj
        public static double CalcDistance(TelegramBot.Models.LocationM Location1, TelegramBot.Models.LocationM Location2, GeoCodeCalcMeasurement m)
        {
            double radius = GeoCodeCalc.EarthRadiusInMiles;

            if (m == GeoCodeCalcMeasurement.Kilometers)
            {
                radius = GeoCodeCalc.EarthRadiusInKilometers;
            }
            return(radius * 2 * Math.Asin(Math.Min(1, Math.Sqrt((Math.Pow(Math.Sin((DiffRadian(Location1.X, Location2.X)) / 2.0), 2.0) + Math.Cos(ToRadian(Location1.X)) * Math.Cos(ToRadian(Location2.X)) * Math.Pow(Math.Sin((DiffRadian(Location1.Y, Location2.Y)) / 2.0), 2.0))))));
        }
Ejemplo n.º 2
0
 public static double CalcDistance(TelegramBot.Models.LocationM Location1, TelegramBot.Models.LocationM Location2)
 {
     return(CalcDistance(Location1, Location2, GeoCodeCalcMeasurement.Miles));
 }