コード例 #1
0
        public void TestBLtoXY()
        {
            {
                double B  = SurMath.DMStoRad(21.58470845);
                double L  = SurMath.DMStoRad(113.25314880);
                double L0 = SurMath.DMStoRad(111);

                //Ellipsoid ellipsoid = new Ellipsoid(6378245, 298.3);
                Ellipsoid ellipsoid = Ellipsoid.CreateBeijing1954();
                IProj     proj      = new GaussProj(ellipsoid);
                var       xy        = proj.BLtoXY(B, L, L0, 0, 0);

                Assert.AreEqual(2433586.692, xy.X, 0.001);
                Assert.AreEqual(250547.403, xy.Y, 0.001);
            }

            //数据来自《大地测量学基础》2版P193
            {
                double B  = SurMath.DMStoRad(17.33557339);
                double L  = SurMath.DMStoRad(119.15521159);
                double L0 = SurMath.DMStoRad(117);

                Ellipsoid ellipsoid = Ellipsoid.CreateBeijing1954();
                IProj     proj      = new GaussProj(ellipsoid);
                var       xy        = proj.BLtoXY(B, L, L0, 0, 0);

                Assert.AreEqual(1944359.6070, xy.X, 0.003);
                Assert.AreEqual(240455.4563, xy.Y, 0.001);
            }

            //数据来自《大地测量学基础》2版P193
            {
                double B  = SurMath.DMStoRad(17.33557339);
                double L  = SurMath.DMStoRad(119.15521159);
                double L0 = SurMath.DMStoRad(117);

                Ellipsoid ellipsoid = Ellipsoid.CreateXiAn1980();
                IProj     proj      = new GaussProj(ellipsoid);
                var       xy        = proj.BLtoXY(B, L, L0, 0, 0);

                Assert.AreEqual(1944325.8030, xy.X, 0.001);
                Assert.AreEqual(240451.5085, xy.Y, 0.001);
            }
        }