public static string GetBData(double x, double y, double z) { double tmpRad = Math.Atan(z * Ellipsoid.a / ((Math.Pow((x * x + y * y), 0.5)) * Ellipsoid.b)); double rabB = Math.Atan(((z + Ellipsoid.se * Math.Pow(Math.Sin(tmpRad), 3))) / (Math.Pow((x * x + y * y), 0.5) - Ellipsoid.e * Ellipsoid.a * Math.Pow(Math.Cos(tmpRad), 3))); return(NumToAngle(Angle.ArcToDMS(rabB))); }
public static string[] GetBLData(double x, double y) { string[] BLStr = new string[2]; double CentralMeridianLongitude = 110; //中央子午线取固定值 double Bf = GetLatitudeByMeridianLength(x, Ellipsoid.c); double W = 0; double Nf = 0; W = Math.Pow((1 - Ellipsoid.e * Math.Pow(Math.Sin(Bf), 2)), 0.5); Nf = Ellipsoid.a / W; double snf = Ellipsoid.se * Math.Cos(Bf) * Math.Cos(Bf); double tf = Math.Tan(Bf); double Mf = Ellipsoid.a * (1 - Ellipsoid.e) / Math.Pow(W, 3); //文档上的公式 //double B0 = Bf; //double B1 = 1 / (Nf * Math.Cos(Bf)); //double B2 = -tf / (2 * Mf * Nf); //double B3 = -(1 + 2 * tf * tf + snf) * B1 / (6 * Nf * Nf); //double B4 = -(5 + 3 * tf * tf + snf - 9 * snf * tf * tf) * B2 / (12 * Nf * Nf); //double B5 = -(5 + 28 * tf * tf + 24 * Math.Pow(tf, 4) + 6 * snf + 8 * snf * tf * tf) * B1 / (120 * Math.Pow(Nf, 4)); //double B6 = (61 + 90 * tf * tf + 45 * Math.Pow(tf, 4)) * B2 / (360 * Math.Pow(Nf, 4)); //网上的公式 double B0 = Bf; double B1 = 1 / (Nf * Math.Cos(Bf)); double B2 = -tf / (2 * Mf * Nf); double B3 = -(1 + 2 * tf * tf + snf) / (6 * Nf * Nf * Nf * Math.Cos(Bf)); double B4 = (5 + 3 * tf * tf + snf - 9 * snf * tf * tf) / (24 * Mf * Nf * Nf * Nf); double B5 = (5 + 28 * tf * tf + 24 * Math.Pow(tf, 4) + 6 * snf + 8 * snf * tf * tf) / (120 * Math.Pow(Nf, 5) * Nf); double B6 = -(61 + 90 * tf * tf + 45 * Math.Pow(tf, 4)) / (720 * Mf * Math.Pow(Nf, 5)); BLStr[0] = NumToAngle(Angle.ArcToDMS(B0 + B2 * y * y + B4 * Math.Pow(y, 4) + B6 * Math.Pow(y, 6))); //BLStr[1] = NumToAngle(Angle.ArcToDMS(B1 * y + B3 * Math.Pow(y, 3) + B5 * Math.Pow(y, 5) + CentralMeridianLongitude)); //BLStr[0] = NumToAngle((B0 + B2 * y * y + B4 * Math.Pow(y, 4) + B6 * Math.Pow(y, 6))); BLStr[1] = NumToAngle((B1 * y + B3 * Math.Pow(y, 3) + B5 * Math.Pow(y, 5) + CentralMeridianLongitude)); return(BLStr); }
public static string GetLData(double x, double y) { double rad = Math.Atan(y / x); return(NumToAngle(Angle.ArcToDMS(rad))); }