Skip to content

Commit e665f8e

Browse files
authored
Fix naming of key for ProjectionRegistry (#132)
1 parent 3767f22 commit e665f8e

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

src/ProjNet/CoordinateSystems/Projections/ProjectionsRegistry.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ static ProjectionsRegistry()
2323
Register("mercator_1sp", typeof(Mercator));
2424
Register("mercator_2sp", typeof(Mercator));
2525
Register("mercator_auxiliary_sphere", typeof(MercatorAuxiliarySphere));
26-
Register("pseudo-mercator", typeof(PseudoMercator));
27-
Register("popular_visualisation pseudo-mercator", typeof(PseudoMercator));
28-
Register("google_mercator", typeof(PseudoMercator));
26+
Register("pseudo_mercator", typeof(PseudoMercator));
27+
Register("popular_visualisation_pseudo_mercator", typeof(PseudoMercator));
28+
Register("google_mercator", typeof(PseudoMercator));
2929

3030
Register("transverse_mercator", typeof(TransverseMercator));
3131
Register("gauss_kruger", typeof(TransverseMercator));
3232

33-
Register("albers", typeof(AlbersProjection));
33+
Register("albers", typeof(AlbersProjection));
3434
Register("albers_conic_equal_area", typeof(AlbersProjection));
35-
35+
3636
Register("krovak", typeof(KrovakProjection));
37-
37+
3838
Register("polyconic", typeof(PolyconicProjection));
3939

40-
Register("lambert_conformal_conic", typeof(LambertConformalConic2SP));
40+
Register("lambert_conformal_conic", typeof(LambertConformalConic2SP));
4141
Register("lambert_conformal_conic_2sp", typeof(LambertConformalConic2SP));
4242
Register("lambert_conic_conformal_(2sp)", typeof(LambertConformalConic2SP));
4343

@@ -90,7 +90,7 @@ public static void Register(string name, Type type)
9090

9191
private static string ProjectionNameToRegistryKey(string name)
9292
{
93-
return name.ToLowerInvariant().Replace(' ', '_');
93+
return name.ToLowerInvariant().Replace(' ', '_').Replace("-", "_");
9494
}
9595

9696
/// <summary>

test/ProjNet.Tests/CoordinateTransformTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,22 @@ public static void TestMercatorAuxilarySphereTransformation()
11501150
Assert.AreEqual(6968468.98, tranformedPoint.y, 0.1);
11511151
}
11521152

1153+
[Test]
1154+
public void TestPopularVisualizationPseudoMercatorProjectionRegistry()
1155+
{
1156+
string sourceWkt = "GEOGCS[\"GCS_WGS_1984\", DATUM[\"D_WGS_1984\", SPHEROID[\"WGS_1984\",6378137.0,298.257223563]], PRIMEM[\"Greenwich\",0.0], UNIT[\"Degree\",0.0174532925199433]]";
1157+
string targetWkt = "PROJCS[\"WGS84.PseudoMercator\",GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722356]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Popular Visualisation Pseudo Mercator\"],PARAMETER[\"false_easting\",0.000],PARAMETER[\"false_northing\",0.000],PARAMETER[\"central_meridian\",0.00000000000000],UNIT[\"Meter\",1.00000000000000]]";
1158+
1159+
var sourceCoordinateSystem = GetCoordinateSystem(sourceWkt);
1160+
Assert.NotNull(sourceCoordinateSystem);
1161+
1162+
var targetCoordinateSystem = GetCoordinateSystem(targetWkt);
1163+
Assert.NotNull(targetCoordinateSystem);
1164+
1165+
var transformation = GetTransformation(sourceCoordinateSystem, targetCoordinateSystem);
1166+
Assert.NotNull(transformation);
1167+
}
1168+
11531169
internal static CoordinateSystem GetCoordinateSystem(string wkt)
11541170
{
11551171
var coordinateSystemFactory = new CoordinateSystemFactory();

0 commit comments

Comments
 (0)