public void OsgbTest() { var projection = new TransverseMercator( new GeographicCoordinate(49 * Math.PI / 180, -2 * Math.PI / 180), new Vector2(400000, -100000), 0.9996012717, new SpheroidEquatorialInvF(6377563.396, 299.32496) ); var a = new Point2(651409.903, 313177.270); var b = new GeographicCoordinate(52.6576 * Math.PI / 180, 1.7179 * Math.PI / 180); var projected = projection.TransformValue(b); Assert.AreEqual(a.X, projected.X, 2); Assert.AreEqual(a.Y, projected.Y, 4); }
public void EpsgExample1351Test() { var projection = new TransverseMercator( new GeographicCoordinate(0.85521133, -0.03490659), new Vector2(400000.00, -100000.00), 0.9996012717, new SpheroidEquatorialInvF(6377563.396, 299.32496) ); var input = new GeographicCoordinate(0.88139127, 0.00872665); var expected = new Point2(577274.99, 69740.50); var result = projection.TransformValue(input); Assert.AreEqual(expected.X, result.X, 0.03); Assert.AreEqual(expected.Y, result.Y, 0.002); }
public void EpsgExample1351Test() { var projection = new TransverseMercator( new GeographicCoordinate(0.85521133, -0.03490659), new Vector2(400000.00, -100000.00), 0.9996012717, new SpheroidEquatorialInvF(6377563.396, 299.32496) ); var input = new GeographicCoordinate(0.88139127, 0.00872665); var expected = new Point2(577274.99, 69740.50); var result = projection.TransformValue(input); Assert.AreEqual(expected.X, result.X, 0.03); Assert.AreEqual(expected.Y, result.Y, 0.002); }
public void Test(string geoResourceName, string prjResourceName, double projectDelta, double unprojectDelta) { var latLonData = GoldData.GetReadyReader(geoResourceName); var prjData = GoldData.GetReadyReader(prjResourceName); var spheroid = GoldData.GenerateSpheroid(prjData["DATUM"]); var projection = new TransverseMercator( new GeographicCoordinate( Double.Parse(prjData["ORIGIN LATITUDE"]) * Math.PI / 180.0, Double.Parse(prjData["CENTRAL MERIDIAN"]) * Math.PI / 180.0 ), new Vector2( Double.Parse(prjData["FALSE EASTING"]), Double.Parse(prjData["FALSE NORTHING"]) ), Double.Parse(prjData["SCALE FACTOR"]), spheroid ); var inverse = projection.GetInverse(); while (latLonData.Read() && prjData.Read()) { var coord = latLonData.CurrentLatLon(); var coordRads = latLonData.CurrentLatLonRadians(); var expected = prjData.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 prjResourceName, double projectDelta, double unprojectDelta) { var latLonData = GoldData.GetReadyReader(geoResourceName); var prjData = GoldData.GetReadyReader(prjResourceName); var spheroid = GoldData.GenerateSpheroid(prjData["DATUM"]); var projection = new TransverseMercator( new GeographicCoordinate( Double.Parse(prjData["ORIGIN LATITUDE"]) * Math.PI / 180.0, Double.Parse(prjData["CENTRAL MERIDIAN"]) * Math.PI / 180.0 ), new Vector2( Double.Parse(prjData["FALSE EASTING"]), Double.Parse(prjData["FALSE NORTHING"]) ), Double.Parse(prjData["SCALE FACTOR"]), spheroid ); var inverse = projection.GetInverse(); while (latLonData.Read() && prjData.Read()) { var coord = latLonData.CurrentLatLon(); var coordRads = latLonData.CurrentLatLonRadians(); var expected = prjData.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 OsgbTest() { var projection = new TransverseMercator( new GeographicCoordinate(49 * Math.PI / 180, -2 * Math.PI / 180), new Vector2(400000, -100000), 0.9996012717, new SpheroidEquatorialInvF(6377563.396, 299.32496) ); var a = new Point2(651409.903, 313177.270); var b = new GeographicCoordinate(52.6576 * Math.PI / 180, 1.7179 * Math.PI / 180); var projected = projection.TransformValue(b); Assert.AreEqual(a.X, projected.X, 2); Assert.AreEqual(a.Y, projected.Y, 4); }