日期:2014-05-17 浏览次数:20620 次
private const double ParaE1 = 6.69438499958795E-03;//椭球体第一偏心率 private const double Parak0 = 1.57048687472752E-07;//有关椭球体的常量 private const double Parak1 = 5.05250559291393E-03;//有关椭球体的常量 private const double Parak2 = 2.98473350966158E-05;//有关椭球体的常量 private const double Parak3 = 2.41627215981336E-07;//有关椭球体的常量 private const double Parak4 = 2.22241909461273E-09;//有关椭球体的常量 private const double ParaC = 6399596.65198801;//极点子午圈曲率半径 /// <summary> /// 高斯坐标转经纬度算法 /// </summary> /// <param name="x">大地坐标X</param> /// <param name="y">大地坐标Y</param> /// <param name="center">中央经线(单位:弧度)</param> private double[] ComputeXYGeo(double x, double y, double center, int n) { double[] bl = { 0,0}; double y1, bf, e, se, v, t, N, nl, vt, yn, t2, g, cbf; y1 = y - 500000 - 1000000 * n;//减去带号 e = Parak0 * x; se = Math.Sin(e); bf = e + Math.Cos(e) * (Parak1 * se - Parak2 * Math.Pow(se, 3) + Parak3 * Math.Pow(se, 5) - Parak4 * Math.Pow(se, 7)); g = 1; t = Math.Tan(bf); nl = ParaE1 * Math.Pow(Math.Cos(bf), 2); v = Math.Sqrt(1 + nl); N = ParaC / v; yn = y1 / N; vt = Math.Pow(v, 2) * t; t2 = Math.Pow(t, 2); //纬度 bl[0] = bf - vt * Math.Pow(yn, 2) / 2.0 + (5.0 + 3.0 * t2 + nl - 9.0 * nl * t2) * vt * Math.Pow(yn, 4) / 24.0 - (61.0 + 90.0 * t2 + 45 * Math.Pow(t2, 2)) * vt * Math.Pow(yn, 6) / 720.0; cbf = 1 / Math.Cos(bf); //经度 bl[1] = cbf * yn - (1.0 + 2.0 * t2 + nl) * cbf * Math.Pow(yn, 3) / 6.0 + (5.0 + 28.0 * t2 + 24.0 * Math.Pow(t2, 2) + 6.0 * nl + 8.0 * nl * t2) * cbf * Math.Pow(yn, 5) / 120.0 + center; return bl; }