public void TestCreateHorizontalDatum1() { ILinearUnit linearUnit = new LinearUnit(1); IEllipsoid ellipsoid = _csFactory.CreateFlattenedSphere("test", 1, 2, linearUnit); WGS84ConversionInfo wgs = new WGS84ConversionInfo(); wgs.Dx = 1; IHorizontalDatum horizontalDatum = _csFactory.CreateHorizontalDatum("name", DatumType.IHD_Geocentric, ellipsoid, wgs); Assertion.AssertEquals("ctor 1", "name", horizontalDatum.Name); Assertion.AssertEquals("ctor 2", DatumType.IHD_Geocentric, horizontalDatum.DatumType); Assertion.AssertEquals("ctor 3", ellipsoid, horizontalDatum.Ellipsoid); Assertion.AssertEquals("ctor 4", wgs, horizontalDatum.WGS84Parameters); }
public void TestAlbersProjectionFeet() { var ellipsoid = CoordinateSystemFactory.CreateFlattenedSphere("Clarke 1866", 6378206.4, 294.9786982138982, LinearUnit.Metre); var datum = CoordinateSystemFactory.CreateHorizontalDatum("Clarke 1866", DatumType.HD_Geocentric, ellipsoid, null); var gcs = CoordinateSystemFactory.CreateGeographicCoordinateSystem("Clarke 1866", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); var parameters = new List <ProjectionParameter>(5) { new ProjectionParameter("central_meridian", -96), new ProjectionParameter("latitude_of_center", 23), new ProjectionParameter("standard_parallel_1", 29.5), new ProjectionParameter("standard_parallel_2", 45.5), new ProjectionParameter("false_easting", 0), new ProjectionParameter("false_northing", 0) }; var projection = CoordinateSystemFactory.CreateProjection("Albers Conical Equal Area", "albers", parameters); var coordsys = CoordinateSystemFactory.CreateProjectedCoordinateSystem("Albers Conical Equal Area", gcs, projection, LinearUnit.Foot, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); var trans = CoordinateTransformationFactory.CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new double[] { -75, 35 }; var pUtm = trans.MathTransform.Transform(pGeo); var pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); var expected = new[] { 1885472.7 / LinearUnit.Foot.MetersPerUnit, 1535925 / LinearUnit.Foot.MetersPerUnit }; Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.1), TransformationError("Albers", expected, pUtm, false)); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), TransformationError("Albers", pGeo, pGeo2, true)); }
public void TestMercator_1SP_Projection_Feet() { var ellipsoid = CoordinateSystemFactory.CreateFlattenedSphere("Bessel 1840", 6377397.155, 299.15281, LinearUnit.Metre); var datum = CoordinateSystemFactory.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Geocentric, ellipsoid, null); var gcs = CoordinateSystemFactory.CreateGeographicCoordinateSystem("Bessel 1840", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); var parameters = new List <ProjectionParameter>(5) { new ProjectionParameter("latitude_of_origin", 0), new ProjectionParameter("central_meridian", 110), new ProjectionParameter("scale_factor", 0.997), new ProjectionParameter("false_easting", 3900000 / LinearUnit.Foot.MetersPerUnit), new ProjectionParameter("false_northing", 900000 / LinearUnit.Foot.MetersPerUnit) }; var projection = CoordinateSystemFactory.CreateProjection("Mercator_1SP", "Mercator_1SP", parameters); var coordsys = CoordinateSystemFactory.CreateProjectedCoordinateSystem("Makassar / NEIEZ", gcs, projection, LinearUnit.Foot, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); var trans = CoordinateTransformationFactory.CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new[] { 120d, -3d }; var pUtm = trans.MathTransform.Transform(pGeo); var pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); var expected = new[] { 5009726.58 / LinearUnit.Foot.MetersPerUnit, 569150.82 / LinearUnit.Foot.MetersPerUnit }; Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), TransformationError("Mercator_1SP", expected, pUtm, false)); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), TransformationError("Mercator_1SP", pGeo, pGeo2, true)); }
public void TestMercator_2SP_Projection() { var ellipsoid = CoordinateSystemFactory.CreateFlattenedSphere("Krassowski 1940", 6378245.0, 298.3, LinearUnit.Metre); var datum = CoordinateSystemFactory.CreateHorizontalDatum("Krassowski 1940", DatumType.HD_Geocentric, ellipsoid, null); var gcs = CoordinateSystemFactory.CreateGeographicCoordinateSystem("Krassowski 1940", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); var parameters = new List <ProjectionParameter>(5) { new ProjectionParameter("latitude_of_origin", 42), new ProjectionParameter("central_meridian", 51), new ProjectionParameter("false_easting", 0), new ProjectionParameter("false_northing", 0) }; var projection = CoordinateSystemFactory.CreateProjection("Mercator_2SP", "Mercator_2SP", parameters); var coordsys = CoordinateSystemFactory.CreateProjectedCoordinateSystem("Pulkovo 1942 / Mercator Caspian Sea", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); var trans = CoordinateTransformationFactory.CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new[] { 53d, 53d }; var pUtm = trans.MathTransform.Transform(pGeo); var pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); var expected = new[] { 165704.29, 5171848.07 }; Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), TransformationError("Mercator_2SP", expected, pUtm, false)); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), TransformationError("Mercator_2SP", pGeo, pGeo2, true)); }
public void TestTransverseMercator_Projection() { var ellipsoid = CoordinateSystemFactory.CreateFlattenedSphere("Airy 1830", 6377563.396, 299.32496, LinearUnit.Metre); var datum = CoordinateSystemFactory.CreateHorizontalDatum("Airy 1830", DatumType.HD_Geocentric, ellipsoid, null); var gcs = CoordinateSystemFactory.CreateGeographicCoordinateSystem("Airy 1830", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); var parameters = new List <ProjectionParameter>(5) { new ProjectionParameter("latitude_of_origin", 49), new ProjectionParameter("central_meridian", -2), new ProjectionParameter("scale_factor", 0.9996012717 /* 0.9996*/), new ProjectionParameter("false_easting", 400000), new ProjectionParameter("false_northing", -100000) }; var projection = CoordinateSystemFactory.CreateProjection("Transverse Mercator", "Transverse_Mercator", parameters); var coordsys = CoordinateSystemFactory.CreateProjectedCoordinateSystem("OSGB 1936 / British National Grid", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); var trans = CoordinateTransformationFactory.CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new[] { 0.5, 50.5 }; var pUtm = trans.MathTransform.Transform(pGeo); var pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); //"POINT(577393.372775651 69673.621953601)" var expected = new[] { 577274.98, 69740.49 }; Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.01), TransformationError("TransverseMercator", expected, pUtm)); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 1E-6), TransformationError("TransverseMercator", pGeo, pGeo2, true)); }
public void TestLambertConicConformal2SP_Projection() { var ellipsoid = /*Ellipsoid.Clarke1866;*/ CoordinateSystemFactory.CreateFlattenedSphere("Clarke 1866", 20925832.16, 294.97470, LinearUnit.USSurveyFoot); var datum = CoordinateSystemFactory.CreateHorizontalDatum("Clarke 1866", DatumType.HD_Geocentric, ellipsoid, null); var gcs = CoordinateSystemFactory.CreateGeographicCoordinateSystem("Clarke 1866", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); var parameters = new List <ProjectionParameter>(5) { new ProjectionParameter("latitude_of_origin", 27.833333333), new ProjectionParameter("central_meridian", -99), new ProjectionParameter("standard_parallel_1", 28.3833333333), new ProjectionParameter("standard_parallel_2", 30.2833333333), new ProjectionParameter("false_easting", 2000000 / LinearUnit.USSurveyFoot.MetersPerUnit), new ProjectionParameter("false_northing", 0) }; var projection = CoordinateSystemFactory.CreateProjection("Lambert Conic Conformal (2SP)", "lambert_conformal_conic_2sp", parameters); var coordsys = CoordinateSystemFactory.CreateProjectedCoordinateSystem("NAD27 / Texas South Central", gcs, projection, LinearUnit.USSurveyFoot, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); var trans = CoordinateTransformationFactory.CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new[] { -96, 28.5 }; var pUtm = trans.MathTransform.Transform(pGeo); var pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); var expected = new[] { 2963503.91 / LinearUnit.USSurveyFoot.MetersPerUnit, 254759.80 / LinearUnit.USSurveyFoot.MetersPerUnit }; Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.05), TransformationError("LambertConicConformal2SP", expected, pUtm)); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), TransformationError("LambertConicConformal2SP", pGeo, pGeo2, true)); }
public void TestTransverseMercator_Projection() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Airy 1830", 6377563.396, 299.32496, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Airy 1830", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Airy 1830", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List <ProjectionParameter> parameters = new List <ProjectionParameter>(5); parameters.Add(new ProjectionParameter("latitude_of_origin", 49)); parameters.Add(new ProjectionParameter("central_meridian", -2)); parameters.Add(new ProjectionParameter("scale_factor", 0.9996012717)); parameters.Add(new ProjectionParameter("false_easting", 400000)); parameters.Add(new ProjectionParameter("false_northing", -100000)); IProjection projection = cFac.CreateProjection("Transverse Mercator", "Transverse_Mercator", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("OSGB 1936 / British National Grid", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); double[] pGeo = new double[] { 0.5, 50.5 }; double[] pUtm = trans.MathTransform.Transform(pGeo); double[] pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); double[] expected = new double[] { 577274.99, 69740.50 }; Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), String.Format("TransverseMercator forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString())); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("TransverseMercator reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString())); }
public void TestMercator_2SP_Projection() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Krassowski 1940", 6378245.0, 298.3, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Krassowski 1940", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Krassowski 1940", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List <ProjectionParameter> parameters = new List <ProjectionParameter>(5); parameters.Add(new ProjectionParameter("latitude_of_origin", 42)); parameters.Add(new ProjectionParameter("central_meridian", 51)); parameters.Add(new ProjectionParameter("false_easting", 0)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Mercator_2SP", "Mercator_2SP", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Pulkovo 1942 / Mercator Caspian Sea", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); double[] pGeo = new double[] { 53, 53 }; double[] pUtm = trans.MathTransform.Transform(pGeo); double[] pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); double[] expected = new double[] { 165704.29, 5171848.07 }; Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), String.Format("Mercator_2SP forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString())); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Mercator_2SP reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString())); }
public void TestLambertConicConformal2SP_Projection() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Clarke 1866", 20925832.16, 294.97470, LinearUnit.USSurveyFoot); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Clarke 1866", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Clarke 1866", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List <ProjectionParameter> parameters = new List <ProjectionParameter>(5); parameters.Add(new ProjectionParameter("latitude_of_origin", 27.833333333)); parameters.Add(new ProjectionParameter("central_meridian", -99)); parameters.Add(new ProjectionParameter("standard_parallel_1", 28.3833333333)); parameters.Add(new ProjectionParameter("standard_parallel_2", 30.2833333333)); parameters.Add(new ProjectionParameter("false_easting", 2000000 / LinearUnit.USSurveyFoot.MetersPerUnit)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Lambert Conic Conformal (2SP)", "lambert_conformal_conic_2sp", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("NAD27 / Texas South Central", gcs, projection, LinearUnit.USSurveyFoot, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); double[] pGeo = new double[] { -96, 28.5 }; double[] pUtm = trans.MathTransform.Transform(pGeo); double[] pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); double[] expected = new double[] { 2963503.91 / LinearUnit.USSurveyFoot.MetersPerUnit, 254759.80 / LinearUnit.USSurveyFoot.MetersPerUnit }; Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.05), String.Format("LambertConicConformal2SP forward transformation outside tolerance, Expected [{0},{1}], got [{2},{3}]", expected[0], expected[1], pUtm[0], pUtm[1])); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("LambertConicConformal2SP reverse transformation outside tolerance, Expected [{0},{1}], got [{2},{3}]", pGeo[0], pGeo[1], pGeo2[0], pGeo2[1])); }
public void TestAlbersProjectionFeet() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Clarke 1866", 6378206.4, 294.9786982138982, LinearUnit.USSurveyFoot); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Clarke 1866", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Clarke 1866", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List <ProjectionParameter> parameters = new List <ProjectionParameter>(5); parameters.Add(new ProjectionParameter("central_meridian", -96)); parameters.Add(new ProjectionParameter("latitude_of_center", 23)); parameters.Add(new ProjectionParameter("standard_parallel_1", 29.5)); parameters.Add(new ProjectionParameter("standard_parallel_2", 45.5)); parameters.Add(new ProjectionParameter("false_easting", 0)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Albers Conical Equal Area", "albers", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Albers Conical Equal Area", gcs, projection, LinearUnit.Foot, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); double[] pGeo = new double[] { -75, 35 }; double[] pUtm = trans.MathTransform.Transform(pGeo); double[] pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); double[] expected = new double[] { 1885472.7 / LinearUnit.Foot.MetersPerUnit, 1535925 / LinearUnit.Foot.MetersPerUnit }; Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.1), String.Format("Albers forward transformation outside tolerance, Expected [{0},{1}], got [{2},{3}]", expected[0], expected[1], pUtm[0], pUtm[1])); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Albers reverse transformation outside tolerance, Expected [{0},{1}], got [{2},{3}]", pGeo[0], pGeo[1], pGeo2[0], pGeo2[1])); }
public void TestMercator_1SP_Projection() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Bessel 1840", 6377397.155, 299.15281, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Bessel 1840", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List <ProjectionParameter> parameters = new List <ProjectionParameter>(5); parameters.Add(new ProjectionParameter("latitude_of_origin", 0)); parameters.Add(new ProjectionParameter("central_meridian", 110)); parameters.Add(new ProjectionParameter("scale_factor", 0.997)); parameters.Add(new ProjectionParameter("false_easting", 3900000)); parameters.Add(new ProjectionParameter("false_northing", 900000)); IProjection projection = cFac.CreateProjection("Mercator_1SP", "Mercator_1SP", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Makassar / NEIEZ", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); double[] pGeo = new double[] { 120, -3 }; double[] pUtm = trans.MathTransform.Transform(pGeo); double[] pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); double[] expected = new double[] { 5009726.58, 569150.82 }; Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), String.Format("Mercator_1SP forward transformation outside tolerance, Expected [{0},{1}], got [{2},{3}]", expected[0], expected[1], pUtm[0], pUtm[1])); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Mercator_1SP reverse transformation outside tolerance, Expected [{0},{1}], got [{2},{3}]", pGeo[0], pGeo[1], pGeo2[0], pGeo2[1])); }
private static CoordinateSystemFactory CreateNad83ToLambertFactory(out IGeographicCoordinateSystem gcs, out IProjectedCoordinateSystem coordsys) { CoordinateSystemFactory cfac = new CoordinateSystemFactory(); // Define ellipsoid GRS 1980 used by NAD83 IEllipsoid ellipsoid = cfac.CreateFlattenedSphere("GRS 1980", 6378137, 298.257222101, LinearUnit.Metre); // Define NAD83 system IHorizontalDatum datum = cfac.CreateHorizontalDatum("NAD83 (CSRS)", DatumType.HD_Other, ellipsoid, null); gcs = cfac.CreateGeographicCoordinateSystem("NAD83 (CSRS)", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); // Define Lambert parameters List <ProjectionParameter> parameters = new List <ProjectionParameter>(5); parameters.Add(new ProjectionParameter("latitude_of_origin", 44)); parameters.Add(new ProjectionParameter("central_meridian", -70)); parameters.Add(new ProjectionParameter("standard_parallel_1", 50)); parameters.Add(new ProjectionParameter("standard_parallel_2", 46)); parameters.Add(new ProjectionParameter("false_easting", 800000)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cfac.CreateProjection("Lambert Conic Conformal (2SP)", "lambert_conformal_conic_2sp", parameters); coordsys = cfac.CreateProjectedCoordinateSystem("NAD83/Lambert", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); return(cfac); }
// GIS RV09 - Slide 4 private IProjectedCoordinateSystem CreateUtmProjection(int utmZone) { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); // Create geographic coordinate system based on the WGS84 datum IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("WGS 84", 6378137, 298.257223563, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("WGS 84", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("WGS 84", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); // Create UTM projection List <ProjectionParameter> parameters = new List <ProjectionParameter>(); parameters.Add(new ProjectionParameter("latitude_of_origin", 0)); parameters.Add(new ProjectionParameter("central_meridian", -183 + 6 * utmZone)); parameters.Add(new ProjectionParameter("scale_factor", 0.9996)); parameters.Add(new ProjectionParameter("false_easting", 500000)); parameters.Add(new ProjectionParameter("false_northing", 0.0)); IProjection projection = cFac.CreateProjection("Transverse Mercator", "Transverse_Mercator", parameters); return(cFac.CreateProjectedCoordinateSystem("WGS 84 / UTM zone " + utmZone.ToString() + "N", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("Norh", AxisOrientationEnum.North))); }
public void TestAlbersProjection() { var cFac = new CoordinateSystemFactory(); var ellipsoid = cFac.CreateFlattenedSphere( "Clarke 1866", 6378206.4, 294.9786982138982, LinearUnit.USSurveyFoot); var datum = cFac.CreateHorizontalDatum( "Clarke 1866", DatumType.HD_Geocentric, ellipsoid, null); var gcs = cFac.CreateGeographicCoordinateSystem( "Clarke 1866", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); var parameters = new List <ProjectionParameter>(5); parameters.Add(new ProjectionParameter("central_meridian", -96)); parameters.Add(new ProjectionParameter("latitude_of_center", 23)); parameters.Add(new ProjectionParameter("standard_parallel_1", 29.5)); parameters.Add(new ProjectionParameter("standard_parallel_2", 45.5)); parameters.Add(new ProjectionParameter("false_easting", 0)); parameters.Add(new ProjectionParameter("false_northing", 0)); var projection = cFac.CreateProjection( "Albers Conical Equal Area", "albers", parameters); var coordsys = cFac.CreateProjectedCoordinateSystem( "Albers Conical Equal Area", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); var trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); var f = GeometryFactory.Default; var pGeo = f.CreatePoint(new Coordinate(-75, 35)); var pUtm = GeometryTransform.TransformPoint(f, pGeo, trans.MathTransform); var pGeo2 = GeometryTransform.TransformPoint(f, pUtm, trans.MathTransform.Inverse()); var expected = f.CreatePoint(new Coordinate(1885472.7, 1535925)); Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.05), string.Format("Albers forward transformation outside tolerance, Expected [{0},{1}], got [{2},{3}]", expected.X, expected.Y, pUtm.X, pUtm.Y)); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), string.Format("Albers reverse transformation outside tolerance, Expected [{0},{1}], got [{2},{3}]", pGeo.X, pGeo.Y, pGeo2.X, pGeo2.Y)); }
public void TestCreateFlattenedSphere1() { ICoordinateSystemFactory csFactory = new CoordinateSystemFactory(); IEllipsoid ellipsoid = csFactory.CreateFlattenedSphere("test", 20926348.0, 294.26068, new LinearUnit(1)); Assertion.AssertEquals("ctor. 1 ", "test", ellipsoid.Name); Assertion.AssertEquals("ctor. 2 ", 20926348.0, ellipsoid.SemiMajorAxis); Assertion.AssertEquals("ctor. 3 ", 20855233.000877455, ellipsoid.SemiMinorAxis); Assertion.AssertEquals("ctor. 4 ", 294.26068, ellipsoid.InverseFlattening); }
public void TestAlbersProjection() { ICoordinateSystemFactory cFac = new CoordinateSystemFactory(); ILinearUnit usSurveyFoot = cFac.CreateLinearUnit(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere( 6378206.4, 294.9786982138982, LinearUnit.USSurveyFoot, "Clarke 1866"); IHorizontalDatum datum = cFac.CreateHorizontalDatum( DatumType.HorizontalGeocentric, ellipsoid, null, "Clarke 1866"); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem( "Clarke 1866", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientation.East), new AxisInfo("Lat", AxisOrientation.North)); //Collection<ProjectionParameter> parameters = new Collection<ProjectionParameter>(5); Collection <ProjectionParameter> parameters = new Collection <ProjectionParameter>(); parameters.Add(new ProjectionParameter("central_meridian", -96)); parameters.Add(new ProjectionParameter("latitude_of_origin", 23)); parameters.Add(new ProjectionParameter("standard_parallel_1", 29.5)); parameters.Add(new ProjectionParameter("standard_parallel_2", 45.5)); parameters.Add(new ProjectionParameter("false_easting", 0)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Albers Conical Equal Area", "albers", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem( gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientation.East), new AxisInfo("North", AxisOrientation.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory() .CreateFromCoordinateSystems(gcs, coordsys); IPoint pGeo = new Point(-75, 35); IPoint pUtm = trans.MathTransform.Transform(pGeo); IPoint pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); IPoint expected = new IPoint(1885472.7, 1535925); Assert.IsTrue(toleranceLessThan(pUtm, expected, 0.05), String.Format("Albers forward transformation outside tolerance, Expected {0}, got {1}", expected, pUtm)); Assert.IsTrue(toleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Albers reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString())); }
public void TestCreateFlattenedSphere2() { ICoordinateSystemFactory csFactory = new CoordinateSystemFactory(); try { IEllipsoid ellipsoid = csFactory.CreateFlattenedSphere("test", 1, 2, null); Assertion.Fail("ArgumentNullException should be thrown for null linear unit parameter."); } catch (ArgumentNullException) { } }
public void TestAlbersProjection() { ICoordinateSystemFactory cFac = new CoordinateSystemFactory(); ILinearUnit usSurveyFoot = cFac.CreateLinearUnit(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere( 6378206.4, 294.9786982138982, LinearUnit.USSurveyFoot, "Clarke 1866"); IHorizontalDatum datum = cFac.CreateHorizontalDatum( DatumType.HorizontalGeocentric, ellipsoid, null, "Clarke 1866"); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem( "Clarke 1866", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientation.East), new AxisInfo("Lat", AxisOrientation.North)); //Collection<ProjectionParameter> parameters = new Collection<ProjectionParameter>(5); Collection<ProjectionParameter> parameters = new Collection<ProjectionParameter>(); parameters.Add(new ProjectionParameter("central_meridian", -96)); parameters.Add(new ProjectionParameter("latitude_of_origin", 23)); parameters.Add(new ProjectionParameter("standard_parallel_1", 29.5)); parameters.Add(new ProjectionParameter("standard_parallel_2", 45.5)); parameters.Add(new ProjectionParameter("false_easting", 0)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Albers Conical Equal Area", "albers", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem( gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientation.East), new AxisInfo("North", AxisOrientation.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory() .CreateFromCoordinateSystems(gcs, coordsys); IPoint pGeo = new Point(-75, 35); IPoint pUtm = trans.MathTransform.Transform(pGeo); IPoint pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); IPoint expected = new IPoint(1885472.7, 1535925); Assert.IsTrue(toleranceLessThan(pUtm, expected, 0.05), String.Format("Albers forward transformation outside tolerance, Expected {0}, got {1}", expected, pUtm)); Assert.IsTrue(toleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Albers reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString())); }
private void TestLambertConicConformal_2SP() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Clarke 1866", 20925832.16, 294.97470, LinearUnit.USSurveyFoot); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Clarke 1866", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Clarke 1866", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List <ProjectionParameter> parameters = new List <ProjectionParameter>(); parameters.Add(new ProjectionParameter("latitude_of_origin", 27.833333333)); parameters.Add(new ProjectionParameter("central_meridian", -99)); parameters.Add(new ProjectionParameter("standard_parallel_1", 28.3833333333)); parameters.Add(new ProjectionParameter("standard_parallel_2", 30.2833333333)); parameters.Add(new ProjectionParameter("false_easting", 2000000)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Lambert Conic Conformal (2SP)", "lambert_conformal_conic_2sp", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("NAD27 / Texas South Central", gcs, projection, LinearUnit.USSurveyFoot, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum. North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new Coordinate(-96, 28.5); var pUtm = Transform(trans.MathTransform, pGeo); trans.MathTransform.Invert(); var pGeo2 = Transform(trans.MathTransform, pUtm); trans.MathTransform.Invert(); result.Text += PrintResultTable(gcs, coordsys, pGeo, pUtm, new Coordinate(2963503.91, 254759.80), pGeo2, "Lambert Conic Conformal 2SP test"); }
private void TestAlbers() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Clarke 1866", 6378206.4, 294.9786982138982, LinearUnit.USSurveyFoot); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Clarke 1866", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Clarke 1866", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List <ProjectionParameter> parameters = new List <ProjectionParameter>(); parameters.Add(new ProjectionParameter("central_meridian", -96)); parameters.Add(new ProjectionParameter("latitude_of_origin", 23)); parameters.Add(new ProjectionParameter("standard_parallel_1", 29.5)); parameters.Add(new ProjectionParameter("standard_parallel_2", 45.5)); parameters.Add(new ProjectionParameter("false_easting", 0)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Albers Conical Equal Area", "albers", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Albers Conical Equal Area", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum. North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new Coordinate(-75, 35); var pUtm = Transform(trans.MathTransform, pGeo); trans.MathTransform.Invert(); var pGeo2 = Transform(trans.MathTransform, pUtm); trans.MathTransform.Invert(); result.Text += PrintResultTable(gcs, coordsys, pGeo, pUtm, new Coordinate(1885472.7, 1535925), pGeo2, "Albers Conical Equal Area test"); }
private void TestMercator_1SP() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Bessel 1840", 6377397.155, 299.15281, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Bessel 1840", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List <ProjectionParameter> parameters = new List <ProjectionParameter>(); parameters.Add(new ProjectionParameter("latitude_of_origin", 0)); parameters.Add(new ProjectionParameter("central_meridian", 110)); parameters.Add(new ProjectionParameter("scale_factor", 0.997)); parameters.Add(new ProjectionParameter("false_easting", 3900000)); parameters.Add(new ProjectionParameter("false_northing", 900000)); IProjection projection = cFac.CreateProjection("Mercator_1SP", "Mercator_1SP", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Makassar / NEIEZ", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum. North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new Coordinate(120, -3); var pUtm = Transform(trans.MathTransform, pGeo); trans.MathTransform.Invert(); var pGeo2 = Transform(trans.MathTransform, pUtm); trans.MathTransform.Invert(); result.Text += PrintResultTable(gcs, coordsys, pGeo, pUtm, new Coordinate(5009726.58, 569150.82), pGeo2, "Mercator_1SP test"); }
public void TestKrovak_Projection() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Bessel 1840", 6377397.155, 299.15281, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Bessel 1840", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List <ProjectionParameter> parameters = new List <ProjectionParameter>(5); parameters.Add(new ProjectionParameter("latitude_of_center", 49.5)); parameters.Add(new ProjectionParameter("longitude_of_center", 42.5)); parameters.Add(new ProjectionParameter("azimuth", 30.28813972222222)); parameters.Add(new ProjectionParameter("pseudo_standard_parallel_1", 78.5)); parameters.Add(new ProjectionParameter("scale_factor", 0.9999)); parameters.Add(new ProjectionParameter("false_easting", 0)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Krovak", "Krovak", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("WGS 84", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); // test case 1 double[] pGeo = new double[] { 12, 48 }; double[] expected = new double[] { -953172.26, -1245573.32 }; double[] pUtm = trans.MathTransform.Transform(pGeo); double[] pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), String.Format("Krovak forward transformation outside tolerance, Expected [{0},{1}], got [{2},{3}]", expected[0], expected[1], pUtm[0], pUtm[1])); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Krovak reverse transformation outside tolerance, Expected [{0},{1}], got [{2},{3}]", pGeo[0], pGeo[1], pGeo2[0], pGeo2[1])); // test case 2 pGeo = new double[] { 18, 49 }; expected = new double[] { -499258.06, -1192389.16 }; pUtm = trans.MathTransform.Transform(pGeo); pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), String.Format("Krovak forward transformation outside tolerance, Expected [{0},{1}], got [{2},{3}]", expected[0], expected[1], pUtm[0], pUtm[1])); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Krovak reverse transformation outside tolerance, Expected [{0},{1}], got [{2},{3}]", pGeo[0], pGeo[1], pGeo2[0], pGeo2[1])); }
private void TestAlbers() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Clarke 1866", 6378206.4, 294.9786982138982, LinearUnit.USSurveyFoot); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Clarke 1866", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Clarke 1866", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List<ProjectionParameter> parameters = new List<ProjectionParameter>(); parameters.Add(new ProjectionParameter("central_meridian", -96)); parameters.Add(new ProjectionParameter("latitude_of_origin", 23)); parameters.Add(new ProjectionParameter("standard_parallel_1", 29.5)); parameters.Add(new ProjectionParameter("standard_parallel_2", 45.5)); parameters.Add(new ProjectionParameter("false_easting", 0)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Albers Conical Equal Area", "albers", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Albers Conical Equal Area", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum. North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new Coordinate(-75, 35); var pUtm = Transform(trans.MathTransform, pGeo); trans.MathTransform.Invert(); var pGeo2 = Transform(trans.MathTransform, pUtm); trans.MathTransform.Invert(); result.Text += PrintResultTable(gcs, coordsys, pGeo, pUtm, new Coordinate(1885472.7, 1535925), pGeo2, "Albers Conical Equal Area test"); }
private void TestTransverseMercator() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Airy 1830", 6377563.396, 299.32496, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Airy 1830", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Airy 1830", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List <ProjectionParameter> parameters = new List <ProjectionParameter>(); parameters.Add(new ProjectionParameter("latitude_of_origin", 49)); parameters.Add(new ProjectionParameter("central_meridian", -2)); parameters.Add(new ProjectionParameter("scale_factor", 0.9996012717)); parameters.Add(new ProjectionParameter("false_easting", 400000)); parameters.Add(new ProjectionParameter("false_northing", -100000)); IProjection projection = cFac.CreateProjection("Transverse Mercator", "Transverse_Mercator", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("OSGB 1936 / British National Grid", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum. North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new Coordinate(0.5, 50.5); var pUtm = Transform(trans.MathTransform, pGeo); trans.MathTransform.Invert(); var pGeo2 = Transform(trans.MathTransform, pUtm); trans.MathTransform.Invert(); result.Text += PrintResultTable(gcs, coordsys, pGeo, pUtm, new Coordinate(577274.99, 69740.50), pGeo2, "Transverse Mercator test"); }
public void TestKrovak_Projection() { var ellipsoid = CoordinateSystemFactory.CreateFlattenedSphere("Bessel 1840", 6377397.155, 299.15281, LinearUnit.Metre); var datum = CoordinateSystemFactory.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Geocentric, ellipsoid, null); var gcs = CoordinateSystemFactory.CreateGeographicCoordinateSystem("Bessel 1840", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); var parameters = new List <ProjectionParameter>(5) { new ProjectionParameter("latitude_of_center", 49.5), new ProjectionParameter("longitude_of_center", 42.5), new ProjectionParameter("azimuth", 30.28813972222222), new ProjectionParameter("pseudo_standard_parallel_1", 78.5), new ProjectionParameter("scale_factor", 0.9999), new ProjectionParameter("false_easting", 0), new ProjectionParameter("false_northing", 0) }; var projection = CoordinateSystemFactory.CreateProjection("Krovak", "Krovak", parameters); var coordsys = CoordinateSystemFactory.CreateProjectedCoordinateSystem("WGS 84", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); var trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); // test case 1 var pGeo = new[] { 12d, 48d }; var expected = new[] { -953172.26, -1245573.32 }; var pUtm = trans.MathTransform.Transform(pGeo); var pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), TransformationError("Krovak", expected, pUtm)); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), TransformationError("Krovak", pGeo, pGeo2, true)); // test case 2 pGeo = new double[] { 18, 49 }; expected = new double[] { -499258.06, -1192389.16 }; pUtm = trans.MathTransform.Transform(pGeo); pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), TransformationError("Krovak", expected, pUtm)); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), TransformationError("Krovak", pGeo, pGeo2)); }
public void Test_Constructor() { ICoordinateSystemFactory csFactory = new CoordinateSystemFactory(); IAngularUnit angularUnit = new AngularUnit(1); ILinearUnit linearUnit = new LinearUnit(1); IEllipsoid ellipsoid = csFactory.CreateFlattenedSphere("test", 1, 2, linearUnit); IAxisInfo axis0 = new AxisInfo("axis0name", AxisOrientation.Up); IAxisInfo axis1 = new AxisInfo("axis1name", AxisOrientation.Up); WGS84ConversionInfo wgs = new WGS84ConversionInfo(); IPrimeMeridian primeMeridian = csFactory.CreatePrimeMeridian("name", angularUnit, 2.0); IHorizontalDatum horizontalDatum = csFactory.CreateHorizontalDatum("datum", DatumType.IHD_Geocentric, ellipsoid, wgs); IGeographicCoordinateSystem gcs = csFactory.CreateGeographicCoordinateSystem("name", angularUnit, horizontalDatum, primeMeridian, axis0, axis1); //PrimeMeridian primeMeridian = new PrimeMeridian("name", angularUnit, 0.5); IAxisInfo[] axisArray = new IAxisInfo[2]; axisArray[0] = axis0; axisArray[1] = axis1; ProjectionParameter[] paramList = new ProjectionParameter[1]; paramList[0].Name = "test"; paramList[0].Value = 2.2; Projection projection = new Projection("mercator", paramList, "class", "remarks", "authority", "authoritycode"); ProjectedCoordinateSystem pjc = new ProjectedCoordinateSystem(horizontalDatum, axisArray, gcs, linearUnit, projection, "remarks", "authority", "authorityCode", "name", "alias", "abbreviation"); Assertion.AssertEquals("Test 1", linearUnit, pjc.LinearUnit); Assertion.AssertEquals("Test 2", horizontalDatum, pjc.HorizontalDatum); Assertion.AssertEquals("Test 3", axis0, pjc.GetAxis(0)); Assertion.AssertEquals("Test 4", axis1, pjc.GetAxis(1)); Assertion.AssertEquals("Test 5", gcs, pjc.GeographicCoordinateSystem); Assertion.AssertEquals("Test 6", "abbreviation", pjc.Abbreviation); Assertion.AssertEquals("Test 7", "alias", pjc.Alias); Assertion.AssertEquals("Test 8", "authority", pjc.Authority); Assertion.AssertEquals("Test 9", "authorityCode", pjc.AuthorityCode); Assertion.AssertEquals("Test 10", "name", pjc.Name); Assertion.AssertEquals("Test 11", "remarks", pjc.Remarks); }
public void TestMercator_1SP_Projection() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Bessel 1840", 6377397.155, 299.15281, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Bessel 1840", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientation.East), new AxisInfo("Lat", AxisOrientation.North)); //Collection<ProjectionParameter> parameters = new Collection<ProjectionParameter>(5); Collection<ProjectionParameter> parameters = new Collection<ProjectionParameter>(); parameters.Add(new ProjectionParameter("latitude_of_origin", 0)); parameters.Add(new ProjectionParameter("central_meridian", 110)); parameters.Add(new ProjectionParameter("scale_factor", 0.997)); parameters.Add(new ProjectionParameter("false_easting", 3900000)); parameters.Add(new ProjectionParameter("false_northing", 900000)); IProjection projection = cFac.CreateProjection("Mercator_1SP", "Mercator_1SP", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Makassar / NEIEZ", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientation.East), new AxisInfo("North", AxisOrientation.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); Point pGeo = new Point(120, -3); Point pUtm = trans.MathTransform.Transform(pGeo); Point pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); Point expected = new Point(5009726.58, 569150.82); Assert.IsTrue(toleranceLessThan(pUtm, expected, 0.02), String.Format("Mercator_1SP forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString())); Assert.IsTrue(toleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Mercator_1SP reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString())); }
public void Test_Constructor() { ICoordinateSystemFactory csFactory = new CoordinateSystemFactory(); IAngularUnit angularUnit = new AngularUnit(1); ILinearUnit linearUnit = new LinearUnit(1); IEllipsoid ellipsoid = csFactory.CreateFlattenedSphere("test", 1, 2, linearUnit); IAxisInfo axis0 = new AxisInfo("axis0name", AxisOrientation.Up); IAxisInfo axis1 = new AxisInfo("axis1name", AxisOrientation.Up); WGS84ConversionInfo wgs = new WGS84ConversionInfo(); IPrimeMeridian primeMeridian = csFactory.CreatePrimeMeridian("name", angularUnit, 2.0); IHorizontalDatum horizontalDatum = csFactory.CreateHorizontalDatum("datum", DatumType.IHD_Geocentric, ellipsoid, wgs); IGeographicCoordinateSystem gcs = csFactory.CreateGeographicCoordinateSystem("name", angularUnit, horizontalDatum, primeMeridian, axis0, axis1); Assertion.AssertEquals("ctor 1", "name", gcs.Name); Assertion.AssertEquals("ctor 2", angularUnit, gcs.AngularUnit); Assertion.AssertEquals("ctor 3", horizontalDatum, gcs.HorizontalDatum); Assertion.AssertEquals("ctor 4", primeMeridian, gcs.PrimeMeridian); Assertion.AssertEquals("ctor 5", axis0, gcs.GetAxis(0)); Assertion.AssertEquals("ctor 5", axis1, gcs.GetAxis(1)); }
private void TestMercator_2SP() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Krassowski 1940", 6378245.0, 298.3, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Krassowski 1940", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Krassowski 1940", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List <ProjectionParameter> parameters = new List <ProjectionParameter>(); parameters.Add(new ProjectionParameter("latitude_of_origin", 42)); parameters.Add(new ProjectionParameter("central_meridian", 51)); parameters.Add(new ProjectionParameter("false_easting", 0)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Mercator_2SP", "Mercator_2SP", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem( "Pulkovo 1942 / Mercator Caspian Sea", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new Coordinate(53, 53); var pUtm = Transform(trans.MathTransform, pGeo); trans.MathTransform.Invert(); var pGeo2 = Transform(trans.MathTransform, pUtm); trans.MathTransform.Invert(); result.Text += PrintResultTable(gcs, coordsys, pGeo, pUtm, new Coordinate(165704.29, 5171848.07), pGeo2, "Mercator_2SP test"); }
private void TestLambertConicConformal_2SP() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Clarke 1866", 20925832.16, 294.97470, LinearUnit.USSurveyFoot); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Clarke 1866", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Clarke 1866", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List<ProjectionParameter> parameters = new List<ProjectionParameter>(); parameters.Add(new ProjectionParameter("latitude_of_origin", 27.833333333)); parameters.Add(new ProjectionParameter("central_meridian", -99)); parameters.Add(new ProjectionParameter("standard_parallel_1", 28.3833333333)); parameters.Add(new ProjectionParameter("standard_parallel_2", 30.2833333333)); parameters.Add(new ProjectionParameter("false_easting", 2000000)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Lambert Conic Conformal (2SP)", "lambert_conformal_conic_2sp", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("NAD27 / Texas South Central", gcs, projection, LinearUnit.USSurveyFoot, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum. North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new Coordinate(-96, 28.5); var pUtm = Transform(trans.MathTransform, pGeo); trans.MathTransform.Invert(); var pGeo2 = Transform(trans.MathTransform, pUtm); trans.MathTransform.Invert(); result.Text += PrintResultTable(gcs, coordsys, pGeo, pUtm, new Coordinate(2963503.91, 254759.80), pGeo2, "Lambert Conic Conformal 2SP test"); }
private void TestMercator_2SP() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Krassowski 1940", 6378245.0, 298.3, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Krassowski 1940", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Krassowski 1940", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List<ProjectionParameter> parameters = new List<ProjectionParameter>(); parameters.Add(new ProjectionParameter("latitude_of_origin", 42)); parameters.Add(new ProjectionParameter("central_meridian", 51)); parameters.Add(new ProjectionParameter("false_easting", 0)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Mercator_2SP", "Mercator_2SP", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem( "Pulkovo 1942 / Mercator Caspian Sea", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new Coordinate(53, 53); var pUtm = Transform(trans.MathTransform, pGeo); trans.MathTransform.Invert(); var pGeo2 = Transform(trans.MathTransform, pUtm); trans.MathTransform.Invert(); result.Text += PrintResultTable(gcs, coordsys, pGeo, pUtm, new Coordinate(165704.29, 5171848.07), pGeo2, "Mercator_2SP test"); }
private void TestTransverseMercator() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Airy 1830", 6377563.396, 299.32496, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Airy 1830", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Airy 1830", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List<ProjectionParameter> parameters = new List<ProjectionParameter>(); parameters.Add(new ProjectionParameter("latitude_of_origin", 49)); parameters.Add(new ProjectionParameter("central_meridian", -2)); parameters.Add(new ProjectionParameter("scale_factor", 0.9996012717)); parameters.Add(new ProjectionParameter("false_easting", 400000)); parameters.Add(new ProjectionParameter("false_northing", -100000)); IProjection projection = cFac.CreateProjection("Transverse Mercator", "Transverse_Mercator", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("OSGB 1936 / British National Grid", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum. North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new Coordinate(0.5, 50.5); var pUtm = Transform(trans.MathTransform, pGeo); trans.MathTransform.Invert(); var pGeo2 = Transform(trans.MathTransform, pUtm); trans.MathTransform.Invert(); result.Text += PrintResultTable(gcs, coordsys, pGeo, pUtm, new Coordinate(577274.99, 69740.50), pGeo2, "Transverse Mercator test"); }
public void TestLambertConicConformal2SP_Projection() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Clarke 1866", 20925832.16, 294.97470, LinearUnit.USSurveyFoot); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Clarke 1866", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Clarke 1866", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientation.East), new AxisInfo("Lat", AxisOrientation.North)); //Collection<ProjectionParameter> parameters = new Collection<ProjectionParameter>(5); Collection<ProjectionParameter> parameters = new Collection<ProjectionParameter>(); parameters.Add(new ProjectionParameter("latitude_of_origin", 27.833333333)); parameters.Add(new ProjectionParameter("central_meridian", -99)); parameters.Add(new ProjectionParameter("standard_parallel_1", 28.3833333333)); parameters.Add(new ProjectionParameter("standard_parallel_2", 30.2833333333)); parameters.Add(new ProjectionParameter("false_easting", 2000000)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Lambert Conic Conformal (2SP)", "lambert_conformal_conic_2sp", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("NAD27 / Texas South Central", gcs, projection, LinearUnit.USSurveyFoot, new AxisInfo("East", AxisOrientation.East), new AxisInfo("North", AxisOrientation.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); Point pGeo = new Point(-96, 28.5); Point pUtm = trans.MathTransform.Transform(pGeo); Point pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); Point expected = new Point(2963503.91, 254759.80); Assert.IsTrue(toleranceLessThan(pUtm, expected, 0.02), String.Format( "LambertConicConformal2SP forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString())); Assert.IsTrue(toleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format( "LambertConicConformal2SP reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString())); }
public void TestTransverseMercator_Projection() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Airy 1830", 6377563.396, 299.32496, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Airy 1830", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Airy 1830", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientation.East), new AxisInfo("Lat", AxisOrientation.North)); //Collection<ProjectionParameter> parameters = new Collection<ProjectionParameter>(5); Collection<ProjectionParameter> parameters = new Collection<ProjectionParameter>(); parameters.Add(new ProjectionParameter("latitude_of_origin", 49)); parameters.Add(new ProjectionParameter("central_meridian", -2)); parameters.Add(new ProjectionParameter("scale_factor", 0.9996012717)); parameters.Add(new ProjectionParameter("false_easting", 400000)); parameters.Add(new ProjectionParameter("false_northing", -100000)); IProjection projection = cFac.CreateProjection("Transverse Mercator", "Transverse_Mercator", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("OSGB 1936 / British National Grid", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientation.East), new AxisInfo("North", AxisOrientation.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); Point pGeo = new Point(0.5, 50.5); Point pUtm = trans.MathTransform.Transform(pGeo); Point pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); Point expected = new Point(577274.99, 69740.50); Assert.IsTrue(toleranceLessThan(pUtm, expected, 0.02), String.Format( "TransverseMercator forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString())); Assert.IsTrue(toleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format( "TransverseMercator reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString())); }
public void TestMercator_2SP_Projection() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Krassowski 1940", 6378245.0, 298.3, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Krassowski 1940", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Krassowski 1940", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientation.East), new AxisInfo("Lat", AxisOrientation.North)); //Collection<ProjectionParameter> parameters = new Collection<ProjectionParameter>(5); Collection<ProjectionParameter> parameters = new Collection<ProjectionParameter>(); parameters.Add(new ProjectionParameter("latitude_of_origin", 42)); parameters.Add(new ProjectionParameter("central_meridian", 51)); parameters.Add(new ProjectionParameter("false_easting", 0)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Mercator_2SP", "Mercator_2SP", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Pulkovo 1942 / Mercator Caspian Sea", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientation.East), new AxisInfo("North", AxisOrientation.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); Point pGeo = new Point(53, 53); Point pUtm = trans.MathTransform.Transform(pGeo); Point pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); Point expected = new Point(165704.29, 5171848.07); Assert.IsTrue(toleranceLessThan(pUtm, expected, 0.02), String.Format("Mercator_2SP forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString())); Assert.IsTrue(toleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Mercator_2SP reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString())); }
private void TestMercator_1SP() { CoordinateSystemFactory cFac = new CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Bessel 1840", 6377397.155, 299.15281, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Bessel 1840", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); List<ProjectionParameter> parameters = new List<ProjectionParameter>(); parameters.Add(new ProjectionParameter("latitude_of_origin", 0)); parameters.Add(new ProjectionParameter("central_meridian", 110)); parameters.Add(new ProjectionParameter("scale_factor", 0.997)); parameters.Add(new ProjectionParameter("false_easting", 3900000)); parameters.Add(new ProjectionParameter("false_northing", 900000)); IProjection projection = cFac.CreateProjection("Mercator_1SP", "Mercator_1SP", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Makassar / NEIEZ", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum. North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); var pGeo = new Coordinate(120, -3); var pUtm = Transform(trans.MathTransform, pGeo); trans.MathTransform.Invert(); var pGeo2 = Transform(trans.MathTransform, pUtm); trans.MathTransform.Invert(); result.Text += PrintResultTable(gcs, coordsys, pGeo, pUtm, new Coordinate(5009726.58, 569150.82), pGeo2, "Mercator_1SP test"); }