public void Test(string geoResourceName, string lccResourceName, double projectDelta, double unprojectDelta)
        {
            var latLonData = GoldData.GetReadyReader(geoResourceName);
            var lccData = GoldData.GetReadyReader(lccResourceName);

            var projection = new LambertConicConformal1Sp(
                new GeographicCoordinate(
                    Double.Parse(lccData["ORIGIN LATITUDE"]) / 180 * Math.PI,
                    Double.Parse(lccData["CENTRAL MERIDIAN"]) / 180 * Math.PI
                ),
                Double.Parse(lccData["SCALE FACTOR"]),
                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 EpsgExample1312()
        {
            var projection = new LambertConicConformal1Sp(
                new GeographicCoordinate(0.31415927, -1.34390352),
                1,
                new Vector2(250000, 150000),
                new SpheroidEquatorialInvF(6378206.400, 294.97870));
            var input = new GeographicCoordinate(0.31297535, -1.34292061);
            var expected = new Point2(255966.58, 142493.51);

            var result = projection.TransformValue(input);

            Assert.AreEqual(expected.X, result.X, 0.006);
            Assert.AreEqual(expected.Y, result.Y, 0.04);
        }
Beispiel #3
0
        public void EpsgExample1312()
        {
            var projection = new LambertConicConformal1Sp(
                new GeographicCoordinate(0.31415927, -1.34390352),
                1,
                new Vector2(250000, 150000),
                new SpheroidEquatorialInvF(6378206.400, 294.97870));
            var input    = new GeographicCoordinate(0.31297535, -1.34292061);
            var expected = new Point2(255966.58, 142493.51);

            var result = projection.TransformValue(input);

            Assert.AreEqual(expected.X, result.X, 0.006);
            Assert.AreEqual(expected.Y, result.Y, 0.04);
        }
        public void Test(string geoResourceName, string lccResourceName, double projectDelta, double unprojectDelta)
        {
            var latLonData = GoldData.GetReadyReader(geoResourceName);
            var lccData    = GoldData.GetReadyReader(lccResourceName);

            var projection = new LambertConicConformal1Sp(
                new GeographicCoordinate(
                    Double.Parse(lccData["ORIGIN LATITUDE"]) / 180 * Math.PI,
                    Double.Parse(lccData["CENTRAL MERIDIAN"]) / 180 * Math.PI
                    ),
                Double.Parse(lccData["SCALE FACTOR"]),
                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);
            }
        }