/// <summary> /// 经纬度之间的距离 /// </summary> /// <param name="from"></param> /// <param name="to"></param> /// <returns></returns> public static double CalcDistance(System.Windows.Point from, System.Windows.Point to) { double rad = 6371; //Earth radius in Km double p1X = from.X / 180 * Math.PI; double p1Y = from.Y / 180 * Math.PI; double p2X = to.X / 180 * Math.PI; double p2Y = to.Y / 180 * Math.PI; return Math.Acos(Math.Sin(p1Y) * Math.Sin(p2Y) + Math.Cos(p1Y) * Math.Cos(p2Y) * Math.Cos(p2X - p1X)) * rad; }