Skip to content

Commit c6ac3b5

Browse files
committed
Add a test for #48 to the suite
Also convert to UTF-8.
1 parent 6154043 commit c6ac3b5

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

ProjNet.Tests/CoordinateTransformTests.cs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Linq;
33
using NetTopologySuite.Geometries;
44
using NUnit.Framework;
@@ -656,7 +656,7 @@ public void TestHotineObliqueMercator()
656656
var csSource = GeographicCoordinateSystem.WGS84;
657657
var csTarget = CoordinateSystemFactory.CreateFromWkt(
658658
"PROJCS[\"NAD83(NSRS2007) / Alaska zone 1\",GEOGCS[\"NAD83(NSRS2007)\",DATUM[\"NAD83_National_Spatial_Reference_System_2007\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6759\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4759\"]],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],PROJECTION[\"Hotine_Oblique_Mercator\"],PARAMETER[\"latitude_of_center\",57],PARAMETER[\"longitude_of_center\",-133.6666666666667],PARAMETER[\"azimuth\",323.1301023611111],PARAMETER[\"rectified_grid_angle\",323.1301023611111],PARAMETER[\"scale_factor\",0.9999],PARAMETER[\"false_easting\",5000000],PARAMETER[\"false_northing\",-5000000],AUTHORITY[\"EPSG\",\"3468\"],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH]]");
659-
//61.216667°, -149.883333°
659+
//61.216667°, -149.883333°
660660
//"POINT(4136805.82642057 -4424019.78560519)"
661661
Test("HotineObliqueMercator", csSource, csTarget,
662662
new[] { -149.883333, 61.216667 },
@@ -712,7 +712,7 @@ public void TestTransformListOnConcatenatedDoTransformDoubleArr()
712712
[Test]
713713
public void AffineTransformationTest ()
714714
{
715-
//Local coordinate system MNAU (Kraftwerk Mäuserich) (based on Gauß-Krüger using affine transformation)
715+
//Local coordinate system MNAU (Kraftwerk Mäerich) (based on Gauß-Krüger using affine transformation)
716716
// affine transform
717717
// 1) Offset: X=-3454886,640m Y=-5479481,278m;
718718
// 2)Rotation: 332,0657, Rotation point X=3456926,640m Y=5481071,278m;
@@ -746,7 +746,7 @@ public void AffineTransformationTest ()
746746
[Test]
747747
public void InverseAffineTransformationTest ()
748748
{
749-
//Local coordinate system MNAU (Kraftwerk Mäuserich) (based on Gauß-Krüger using affine transformation)
749+
//Local coordinate system MNAU (Kraftwerk Mäuserich) (based on Gauß-Krüger using affine transformation)
750750
// affine transform
751751
// 1) Offset: X=-3454886,640m Y=-5479481,278m;
752752
// 2)Rotation: 332,0657, Rotation point X=3456926,640m Y=5481071,278m;
@@ -797,7 +797,7 @@ public void InverseAffineTransformationTest ()
797797
public void TestTransformOnFittedCoordinateSystem ()
798798
{
799799

800-
//Local coordinate system MNAU (Kraftwerk Mäuserich) (based on Gauß-Krüger using affine transformation)
800+
//Local coordinate system MNAU (Kraftwerk Mäuserich) (based on Gauß-Krüger using affine transformation)
801801
// affine transform
802802
// 1) Offset: X=-3454886,640m Y=-5479481,278m;
803803
// 2)Rotation: 332,0657, Rotation point X=3456926,640m Y=5481071,278m;
@@ -879,5 +879,22 @@ public void Test_EPSG_21780_PrimeMeredianTransformation()
879879
Assert.AreEqual(sourceCoord[1], transformedCoord[1], 0.1);
880880

881881
}
882+
883+
// https://github.com/NetTopologySuite/ProjNet4GeoAPI/issues/48
884+
[Test]
885+
public void Test_EPSG_2056_HotineObliqueMercatorAzimuthCenter_Switzerland()
886+
{
887+
var csSrc = GeographicCoordinateSystem.WGS84;
888+
var csTgt = new CoordinateSystemFactory().CreateFromWkt(@"PROJCS[""CH1903+ / LV95"",GEOGCS[""CH1903+"",DATUM[""CH1903+"",SPHEROID[""Bessel 1841"",6377397.155,299.1528128,AUTHORITY[""EPSG"",""7004""]],TOWGS84[674.374,15.056,405.346,0,0,0,0],AUTHORITY[""EPSG"",""6150""]],PRIMEM[""Greenwich"",0,AUTHORITY[""EPSG"",""8901""]],UNIT[""degree"",0.0174532925199433,AUTHORITY[""EPSG"",""9122""]],AUTHORITY[""EPSG"",""4150""]],PROJECTION[""Hotine_Oblique_Mercator""],PARAMETER[""latitude_of_center"",46.95240555555556],PARAMETER[""longitude_of_center"",7.439583333333333],PARAMETER[""azimuth"",90],PARAMETER[""rectified_grid_angle"",90],PARAMETER[""scale_factor"",1],PARAMETER[""false_easting"",2600000],PARAMETER[""false_northing"",1200000],UNIT[""metre"",1,AUTHORITY[""EPSG"",""9001""]],AXIS[""Y"",EAST],AXIS[""X"",NORTH],AUTHORITY[""EPSG"",""2056""]]");
889+
var transformer = new CoordinateTransformationFactory().CreateFromCoordinateSystems(csSrc, csTgt);
890+
double x = 9.619803;
891+
double y = 47.408735;
892+
893+
transformer.MathTransform.Transform(ref x, ref y);
894+
895+
// https://epsg.io/transform#s_srs=4326&t_srs=2056&x=9.6198031&y=47.4087350
896+
Assert.That(x, Is.EqualTo(2764607.79).Within(0.1));
897+
Assert.That(y, Is.EqualTo(1253167.89).Within(0.1));
898+
}
882899
}
883900
}

0 commit comments

Comments
 (0)