public void EpsgExample1311Test()
        {
            var proj = new LambertConicConformal2Sp(
                new GeographicCoordinate(0.48578331, -1.72787596),
                0.49538262,
                0.52854388,
                new Vector2(2000000.0, 0),
                new SpheroidEquatorialInvF(20925832.16, 294.97870)
            );
            var a = new GeographicCoordinate(0.49741884, -1.67551608);
            var b = new Point2(2963503.91, 254759.80);

            var projected = proj.TransformValue(a);
            Assert.AreEqual(b.X, projected.X, 0.05);
            Assert.AreEqual(b.Y, projected.Y, 0.04);
        }
        public void EpsgExample1311Test()
        {
            var proj = new LambertConicConformal2Sp(
                new GeographicCoordinate(0.48578331, -1.72787596),
                0.49538262,
                0.52854388,
                new Vector2(2000000.0, 0),
                new SpheroidEquatorialInvF(20925832.16, 294.97870)
                );
            var a = new GeographicCoordinate(0.49741884, -1.67551608);
            var b = new Point2(2963503.91, 254759.80);

            var projected = proj.TransformValue(a);

            Assert.AreEqual(b.X, projected.X, 0.05);
            Assert.AreEqual(b.Y, projected.Y, 0.04);
        }
Beispiel #3
0
        public void Test(string geoResourceName, string lccResourceName, double projectDelta, double unprojectDelta)
        {
            var latLonData = GoldData.GetReadyReader(geoResourceName);
            var lccData    = GoldData.GetReadyReader(lccResourceName);

            var projection = new LambertConicConformal2Sp(
                new GeographicCoordinate(
                    Double.Parse(lccData["ORIGIN LATITUDE"]) / 180 * Math.PI,
                    Double.Parse(lccData["CENTRAL MERIDIAN"]) / 180 * Math.PI
                    ),
                Double.Parse(lccData["STANDARD PARALLEL ONE"]) / 180 * Math.PI,
                Double.Parse(lccData["STANDARD PARALLEL TWO"]) / 180 * Math.PI,
                new Vector2(
                    Double.Parse(lccData["FALSE EASTING"]),
                    Double.Parse(lccData["FALSE NORTHING"])
                    ),
                GoldData.GenerateSpheroid(lccData["DATUM"])
                );

            var inverse = projection.GetInverse();

            while (latLonData.Read() && lccData.Read())
            {
                var coord     = latLonData.CurrentLatLon();
                var coordRads = latLonData.CurrentLatLonRadians();
                var expected  = lccData.CurrentPoint2D();

                var projected = projection.TransformValue(coordRads);
                Assert.AreEqual(expected.X, projected.X, projectDelta);
                Assert.AreEqual(expected.Y, projected.Y, projectDelta);

                var unProjected = inverse.TransformValue(expected);
                unProjected = new GeographicCoordinate(unProjected.Latitude * 180.0 / Math.PI, unProjected.Longitude * 180.0 / Math.PI);
                Assert.AreEqual(coord.Latitude, unProjected.Latitude, unprojectDelta);
                Assert.AreEqual(coord.Longitude, unProjected.Longitude, unprojectDelta);
            }
        }
        public void Test(string geoResourceName, string lccResourceName, double projectDelta, double unprojectDelta)
        {
            var latLonData = GoldData.GetReadyReader(geoResourceName);
            var lccData = GoldData.GetReadyReader(lccResourceName);

            var projection = new LambertConicConformal2Sp(
                new GeographicCoordinate(
                    Double.Parse(lccData["ORIGIN LATITUDE"]) / 180 * Math.PI,
                    Double.Parse(lccData["CENTRAL MERIDIAN"]) / 180 * Math.PI
                ),
                Double.Parse(lccData["STANDARD PARALLEL ONE"]) / 180 * Math.PI,
                Double.Parse(lccData["STANDARD PARALLEL TWO"]) / 180 * Math.PI,
                new Vector2(
                    Double.Parse(lccData["FALSE EASTING"]),
                    Double.Parse(lccData["FALSE NORTHING"])
                ),
                GoldData.GenerateSpheroid(lccData["DATUM"])
            );

            var inverse = projection.GetInverse();

            while (latLonData.Read() && lccData.Read()) {
                var coord = latLonData.CurrentLatLon();
                var coordRads = latLonData.CurrentLatLonRadians();
                var expected = lccData.CurrentPoint2D();

                var projected = projection.TransformValue(coordRads);
                Assert.AreEqual(expected.X, projected.X, projectDelta);
                Assert.AreEqual(expected.Y, projected.Y, projectDelta);

                var unProjected = inverse.TransformValue(expected);
                unProjected = new GeographicCoordinate(unProjected.Latitude * 180.0 / Math.PI, unProjected.Longitude * 180.0 / Math.PI);
                Assert.AreEqual(coord.Latitude, unProjected.Latitude, unprojectDelta);
                Assert.AreEqual(coord.Longitude, unProjected.Longitude, unprojectDelta);
            }
        }