2 chenyang373 chenyang373 于 2016.03.04 18:03 提问

高斯投影正算关于修改椭球参数的问题
    下面是高斯正算的代码,可以实现BL到54的转换,没有问题,我现在要实现BL到80的转换,我应该怎么改椭球参数呢?

            const double PI = Math.PI; //定义圆周率
    const double rho = 206264.806247096355;
    /// <summary>
    /// 高斯正算
    /// </summary>
    /// <param name="B">纬度(度)</param>
    /// <param name="L">经度(度)</param>
    /// <param name="num">带号</param>
    public double[] CalculateEllipse2plane(double B,double L,double num)
    {
        AngleCalculate ac = new AngleCalculate(); //用于角度弧度转换

        double l,L0,a0,a3,a4,a5,a6,n,c;
        l = 0;L0 = 0;a0 = 0;a3 = 0;a4 = 0;a5 = 0;a6 = 0;n = 0;c = 0;
        double x,y;
        x = 0;y = 0;
        double m, p;
        m = 0;p = 0;
        int N;//带号
        N = 0;
        //判断带号
        if(num == 6)
        {
            N = (int)L/6;//带号
            L0 = 6*N-3;//中央子午线
        }
        else
        {
            N = (int)((L+1.5)/3); //3度带号
            L0 = 3*N;//3度中央子午线
        }

        bool sign = true;

        l = (L - L0) * 3600/rho; //单位秒

        if (l < 0) sign = false;

        B = ac.AngleToArc(B);//将纬度化为弧度
        L = ac.AngleToArc(L);//将经度化为弧度
        L0 = ac.AngleToArc(L0);//将中央子午线转为弧度

        l = Math.Pow(l,2);
        c = Math.Pow(Math.Cos(B),2); //Cos(B)的平方
        //n = 6399596.651988010- (21562.267 - (108.973 - 0.612 * c) * c) * c;
        n = 6399698.902-(21562.267-(108.973-0.612 * c)*c)*c;
        a0 = 32140.404-(135.3302-(0.7092-0.0040*c)*c)*c; 
        a3 =(0.3333333+0.001123*c)*c-0.1666667;
        a4 = (0.25+0.00252*c)*c-0.04166;
        a5=0.0083-(0.1667-(0.1968+0.004*c)*c)*c;
        a6=(0.166*c-0.084)*c; 
        //计算平面坐标并化为国家统一坐标
        m=Math.Sin(B)*Math.Cos(B);
        p = 1+(a3+a5*l)*l;
        x=6367558.4969*B-(a0-(0.5+(a4+a6*l)*l)*l*n)*m;
        y=(p)*Math.Sqrt(l)*n*Math.Cos(B);

        if (sign)
        {
            y = y + 500000 + N * 1000000; //加上常数改正,和带号
        }
        else
        {
            y =  (500000 - y) + N * 1000000; //加上常数改正,和带号
        }

        double[] CalculateResult = new double[2];
        CalculateResult[0] = x;
        CalculateResult[1] = y;

        return CalculateResult;
    }

1个回答

caozhy
caozhy   Ds   Rxr 2016.03.06 08:08
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!