Пример #1
0
        public static XYCoord Mercator(ellipsoid ellip, LBCoord _lbc, double _log1, double _log0, double _lat0)
        {
            Ellipsoid _ellip = new Ellipsoid(ellip);
            double    e1     = _ellip.e1;
            double    e2     = _ellip.e2;

            double FE = 0;
            double FN = 0;

            //result+="ellipsoid.Clarke1866\n";
            double a    = _ellip.a;
            double log0 = _log0 * Math.PI / 180.0;
            double lat0 = _lat0 * Math.PI / 180.0;
            double log  = _lbc.lon * Math.PI / 180.0;
            double lat  = _lbc.lat * Math.PI / 180.0;

            double log1 = tools.toRad(_log1);
            double k0   = Math.Cos(log1) / Math.Sqrt(1 - Math.Pow(e1 * Math.Sin(log1), 2));

            double E = FE + a * k0 * (lat - lat0);
            double N = FN +
                       a * k0 *
                       Math.Log(
                Math.Tan(Math.PI / 4 + log / 2) * Math.Pow((1 - e1 * Math.Sin(log)) / (1 + e1 * Math.Sin(log)), e1 / 2),
                Math.E);

            return(new XYCoord(E, N));
        }
Пример #2
0
        public static XYCoord UTM(ellipsoid ellip, bool isSouth_hemisphere, LBCoord _lbc, double _log0, double _lat0)
        {
            Ellipsoid _ellip = new Ellipsoid(ellip);
            double    e1     = _ellip.e1;
            double    e2     = _ellip.e2;
            double    k0     = 0.9996;
            double    FE     = 500000;
            double    FN     = 0;

            if (isSouth_hemisphere)
            {
                FN = 10000000;
            }

            double a    = _ellip.a;
            double log0 = _log0 * Math.PI / 180.0;
            double lat0 = _lat0 * Math.PI / 180.0;

            double log = _lbc.lon * Math.PI / 180.0;
            double lat = _lbc.lat * Math.PI / 180.0;


            double T = Math.Tan(log) * Math.Tan(log);
            double C = e1 * e1 * Math.Pow(Math.Cos(log), 2) / (1 - e1 * e1);
            double A = (lat - lat0) * Math.Cos(log);
            double v = a / Math.Pow(1 - e1 * e1 * Math.Sin(log) * Math.Sin(log), 0.5);
            double M = a * ((1 - Math.Pow(e1, 2) / 4 - 3 * Math.Pow(e1, 4) / 64 - 5 * Math.Pow(e1, 6) / 256) * log -
                            (3 * Math.Pow(e1, 2) / 8 + 3 * Math.Pow(e1, 4) / 32 + 45 * Math.Pow(e1, 6) / 1024) * Math.Sin(2 * log) +
                            (15 * Math.Pow(e1, 4) / 256 + 45 * Math.Pow(e1, 6) / 1024) * Math.Sin(4 * log) -
                            (35 * Math.Pow(e1, 6) / 3027) * Math.Sin(6 * log));
            double M0 = a * ((1 - Math.Pow(e1, 2) / 4 - 3 * Math.Pow(e1, 4) / 64 - 5 * Math.Pow(e1, 6) / 256) * log0 -
                             (3 * Math.Pow(e1, 2) / 8 + 3 * Math.Pow(e1, 4) / 32 + 45 * Math.Pow(e1, 6) / 1024) * Math.Sin(2 * log0) +
                             (15 * Math.Pow(e1, 4) / 256 + 45 * Math.Pow(e1, 6) / 1024) * Math.Sin(4 * log0) -
                             (35 * Math.Pow(e1, 6) / 3027) * Math.Sin(6 * log0));



            double E = FE +
                       k0 * v * (A + (1 - T + C) * Math.Pow(A, 3) / 6 + (5 - 18 * T + T * T + 72 * C - 58 * e2 * e2) * Math.Pow(A, 5) / 120);
            double N = FN +
                       k0 *
                       (M - M0 +
                        v * Math.Tan(log) *
                        (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * Math.Pow(A, 4) / 24 +
                         (61 - 58 * T + T * T + 600 * C - 330 * e2 * e2) * Math.Pow(A, 6) / 720));

            return(new XYCoord(E, N));
        }
Пример #3
0
        public static XYCoord lambert(ellipsoid ellip, LBCoord _lbc, double _log1, double _log2, double _log0,
                                      double _lat0, ref string result)
        {
            Ellipsoid _ellip = new Ellipsoid(ellip);
            double    e      = _ellip.e1;

            //result+="ellipsoid.Clarke1866\n";

            result += "e:" + e.ToString() + " a:" + _ellip.a.ToString() + "\n";
            result += "-------------------------------------\n";
            double log1 = _log1 * Math.PI / 180.0;
            double log2 = _log2 * Math.PI / 180.0;

            result += "log1:" + log1.ToString() + "\n";
            result += "log1:" + log2.ToString() + "\n";


            double log0 = _log0 * Math.PI / 180.0;
            double lat0 = _lat0 * Math.PI / 180.0;

            result += "log0:" + log0.ToString() + "\n";
            result += "lat0:" + lat0.ToString() + "\n";

            double log = _lbc.lon * Math.PI / 180.0;
            double lat = _lbc.lat * Math.PI / 180.0;

            result += "log:" + log.ToString() + "\n";
            result += "lat:" + lat.ToString() + "\n";


            //double jiao=Math.Asin(e*Math.Sin(l));

            result += "-------------------------------------\n";

            double m1 = Math.Cos(log1) / Math.Sqrt(1 - e * e * Math.Sin(log1) * Math.Sin(log1));
            double m2 = Math.Cos(log2) / Math.Sqrt(1 - e * e * Math.Sin(log2) * Math.Sin(log2));

            result += "m1:" + m1.ToString() + "\n";
            result += "m1:" + m2.ToString() + "\n";

            double t1 = Lam_gett(log1, e);
            double t2 = Lam_gett(log2, e);
            double tF = Lam_gett(log0, e);
            double t  = Lam_gett(log, e);

            result += "t1:" + t1.ToString() + "\n";
            result += "t2:" + t2.ToString() + "\n";
            result += "tF:" + tF.ToString() + "\n";
            result += "t:" + t.ToString() + "\n";

            double n = Math.Log(m1 / m2, Math.E) / Math.Log(t1 / t2, Math.E);

            double F = m1 / (n * Math.Pow(t1, n));

            double r  = _ellip.a * F * Math.Pow(t, n);
            double rF = _ellip.a * (F * Math.Pow(tF, n));


            double tht = n * (lat - lat0);

            result += "a:" + _ellip.a.ToString() + "\n";
            result += "n:" + n.ToString() + "\n";
            result += "F:" + F.ToString() + "\n";
            result += "r:" + r.ToString() + "\n";
            result += "rF:" + rF.ToString() + "\n";
            result += "tht:" + tht.ToString() + "\n";

            return(new XYCoord(r * Math.Sin(tht), rF - r * Math.Cos(tht)));
        }
Пример #4
0
        public static XYCoord albers(ellipsoid ellip, LBCoord _lbc, double _log1, double _log2, double _log0,
                                     double _lat0, ref string result)
        {
            Ellipsoid _ellip = new Ellipsoid(ellip);

            double e = _ellip.e1;

            result += "e:" + e.ToString() + " a:" + _ellip.a.ToString() + "\n";
            result += "-------------------------------------\n";

            double l1 = _log1 * Math.PI / 180.0;
            double l2 = _log2 * Math.PI / 180.0;

            double l0   = _log0 * Math.PI / 180.0;
            double lmt0 = _lat0 * Math.PI / 180.0;

            double l   = _lbc.lon * Math.PI / 180.0;
            double lmt = _lbc.lat * Math.PI / 180.0;


            result += "l1:" + l1.ToString() + "\n";

            result += "l2:" + l2.ToString() + "\n";
            result += "l0:" + l0.ToString() + "\n";
            result += "lmt0:" + lmt0.ToString() + "\n";
            result += "l:" + l.ToString() + "\n";
            result += "lmt:" + lmt.ToString() + "\n";
            result += "-----------------------\n";


            double alpha0 = getalpha(_ellip, l0);
            double alpha1 = getalpha(_ellip, l1);
            double alpha2 = getalpha(_ellip, l2);

            double alpha = getalpha(_ellip, l);

            result += "alpha0:" + alpha0.ToString() + "\n";
            result += "alpha1:" + alpha1.ToString() + "\n";
            result += "alpha2:" + alpha2.ToString() + "\n";
            result += "alpha:" + alpha.ToString() + "\n";


            double m1 = Math.Cos(l1) / Math.Pow(1 - e * e * Math.Sin(l1) * Math.Sin(l1), 0.5);
            double m2 = Math.Cos(l2) / Math.Pow(1 - e * e * Math.Sin(l2) * Math.Sin(l2), 0.5);

            result += "m1:" + m1.ToString() + "\n";
            result += "m2:" + m2.ToString() + "\n";

            double n = (m1 * m1 - m2 * m2) / (alpha2 - alpha1);
            //double c=_ellip.a*_ellip.a*(m1*m1+n*alpha1);
            double c = (m1 * m1 * alpha2 - m2 * m2 * alpha1) / (alpha2 - alpha1);

            result += "n:" + n.ToString() + "\n";
            result += "c:" + c.ToString() + "\n";

            double tht  = n * (lmt - lmt0);
            double rol  = (_ellip.a * Math.Sqrt(c - n * alpha)) / n;
            double rol0 = (_ellip.a * Math.Sqrt(c - n * alpha0)) / n;

            result += "tht:" + tht.ToString() + "\n";
            result += "rol:" + rol.ToString() + "\n";
            result += "rol0:" + rol0.ToString() + "\n";

            double  E = rol * Math.Sin(tht);
            double  N = rol0 - (rol * Math.Cos(tht));
            XYCoord xyc;

            xyc.X = E;
            xyc.Y = N;

            return(xyc);
        }