Skip to content

Commit b703388

Browse files
committed
polar stereographic true scale latitude
1 parent 57f0078 commit b703388

4 files changed

Lines changed: 102 additions & 8 deletions

File tree

src/main/java/mil/nga/crs/projected/MapProjectionMethods.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ public enum MapProjectionMethods {
113113
/**
114114
* Polar Stereographic (variant A)
115115
*/
116-
POLAR_STEREOGRAPHIC_A("Polar Stereographic (variant A)", 9810, 8801, 8802,
117-
8805, 8806, 8807),
116+
POLAR_STEREOGRAPHIC_A("Polar Stereographic (variant A)",
117+
"Polar Stereographic", 9810, 8801, 8802, 8805, 8806, 8807),
118118

119119
/**
120120
* Polar Stereographic (variant B)

src/main/java/mil/nga/proj/CRSParser.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ public static void updateProjection(Projection projection,
435435
if (method.hasParameters()) {
436436
for (MapProjectionParameter parameter : method
437437
.getMapProjectionParameters()) {
438-
updateProjection(projection, parameter);
438+
updateProjection(projection, method, parameter);
439439
}
440440
}
441441
}
@@ -445,11 +445,13 @@ public static void updateProjection(Projection projection,
445445
*
446446
* @param projection
447447
* proj4j projection
448+
* @param method
449+
* map projection method
448450
* @param parameter
449451
* map projection parameter
450452
*/
451453
public static void updateProjection(Projection projection,
452-
MapProjectionParameter parameter) {
454+
MapProjectionMethod method, MapProjectionParameter parameter) {
453455

454456
if (parameter.hasParameter()) {
455457

@@ -498,6 +500,17 @@ public static void updateProjection(Projection projection,
498500
} else {
499501
projection.setProjectionLatitude(value);
500502
}
503+
if (method.hasMethod()) {
504+
switch (method.getMethod()) {
505+
case POLAR_STEREOGRAPHIC_A:
506+
case POLAR_STEREOGRAPHIC_B:
507+
case POLAR_STEREOGRAPHIC_C:
508+
projection.setTrueScaleLatitude(
509+
projection.getProjectionLatitude());
510+
break;
511+
default:
512+
}
513+
}
501514
break;
502515

503516
case LONGITUDE_OF_PROJECTION_CENTRE:

src/test/java/mil/nga/crs/wkt/CRSReaderWriterEpsgTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -848,8 +848,8 @@ public void test5041() throws IOException {
848848
assertEquals(expectedText, CRSWriter.write(crs));
849849
assertEquals(WKTUtils.pretty(expectedText), CRSWriter.writePretty(crs));
850850

851-
text = "PROJCS[\"WGS 84 / UPS North (E,N)\"," + "GEOGCS[\"WGS 84\","
852-
+ "DATUM[\"WGS_1984\","
851+
text = "PROJCS[\"WGS 84 / UPS North (E,N)\","
852+
+ "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\","
853853
+ "SPHEROID[\"WGS 84\",6378137,298.257223563,"
854854
+ "AUTHORITY[\"EPSG\",\"7030\"]],"
855855
+ "AUTHORITY[\"EPSG\",\"6326\"]],"
@@ -862,8 +862,8 @@ public void test5041() throws IOException {
862862
+ "PARAMETER[\"central_meridian\",0],"
863863
+ "PARAMETER[\"scale_factor\",0.994],"
864864
+ "PARAMETER[\"false_easting\",2000000],"
865-
+ "PARAMETER[\"false_northing\",2000000]," + "UNIT[\"metre\",1,"
866-
+ "AUTHORITY[\"EPSG\",\"9001\"]],"
865+
+ "PARAMETER[\"false_northing\",2000000],"
866+
+ "UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],"
867867
+ "AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],"
868868
+ "AUTHORITY[\"EPSG\",\"5041\"]]";
869869

src/test/java/mil/nga/proj/ProjectionFactoryEpsgTest.java

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,87 @@ public void test4979() {
419419

420420
}
421421

422+
/**
423+
* Test EPSG 5041
424+
*/
425+
@Test
426+
public void test5041() {
427+
428+
final long code = 5041;
429+
430+
String definition = "PROJCRS[\"WGS 84 / UPS North (E,N)\",BASEGEOGCRS[\"WGS 84\","
431+
+ "ENSEMBLE[\"World Geodetic System 1984 ensemble\","
432+
+ "MEMBER[\"World Geodetic System 1984 (Transit)\",ID[\"EPSG\",1166]],"
433+
+ "MEMBER[\"World Geodetic System 1984 (G730)\",ID[\"EPSG\",1152]],"
434+
+ "MEMBER[\"World Geodetic System 1984 (G873)\",ID[\"EPSG\",1153]],"
435+
+ "MEMBER[\"World Geodetic System 1984 (G1150)\",ID[\"EPSG\",1154]],"
436+
+ "MEMBER[\"World Geodetic System 1984 (G1674)\",ID[\"EPSG\",1155]],"
437+
+ "MEMBER[\"World Geodetic System 1984 (G1762)\",ID[\"EPSG\",1156]],"
438+
+ "ELLIPSOID[\"WGS 84\",6378137,298.257223563,ID[\"EPSG\",7030]],"
439+
+ "ENSEMBLEACCURACY[2],ID[\"EPSG\",6326]],ID[\"EPSG\",4326]],"
440+
+ "CONVERSION[\"Universal Polar Stereographic North\","
441+
+ "METHOD[\"Polar Stereographic (variant A)\",ID[\"EPSG\",9810]],"
442+
+ "PARAMETER[\"Latitude of natural origin\",90,ANGLEUNIT[\"degree\",0.0174532925199433,ID[\"EPSG\",9102]]],"
443+
+ "PARAMETER[\"Longitude of natural origin\",0,ANGLEUNIT[\"degree\",0.0174532925199433,ID[\"EPSG\",9102]]],"
444+
+ "PARAMETER[\"Scale factor at natural origin\",0.994,SCALEUNIT[\"unity\",1,ID[\"EPSG\",9201]]],"
445+
+ "PARAMETER[\"False easting\",2000000,LENGTHUNIT[\"metre\",1,ID[\"EPSG\",9001]]],"
446+
+ "PARAMETER[\"False northing\",2000000,LENGTHUNIT[\"metre\",1,ID[\"EPSG\",9001]]],"
447+
+ "ID[\"EPSG\",16061]],CS[Cartesian,2,ID[\"EPSG\",1026]],"
448+
+ "AXIS[\"Easting (E)\",South,MERIDIAN[90.0,ANGLEUNIT[\"degree\",0.0174532925199433]]],"
449+
+ "AXIS[\"Northing (N)\",South,MERIDIAN[180.0,ANGLEUNIT[\"degree\",0.0174532925199433]]],"
450+
+ "LENGTHUNIT[\"metre\",1,ID[\"EPSG\",9001]],ID[\"EPSG\",5041]]";
451+
452+
projectionTestDerived(code, definition);
453+
454+
definition = "PROJCS[\"WGS 84 / UPS North (E,N)\","
455+
+ "GEOGCS[\"WGS 84\"," + "DATUM[\"WGS_1984\","
456+
+ "SPHEROID[\"WGS 84\",6378137,298.257223563,"
457+
+ "AUTHORITY[\"EPSG\",\"7030\"]],"
458+
+ "AUTHORITY[\"EPSG\",\"6326\"]],"
459+
+ "PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],"
460+
+ "UNIT[\"degree\",0.0174532925199433,"
461+
+ "AUTHORITY[\"EPSG\",\"9122\"]],"
462+
+ "AUTHORITY[\"EPSG\",\"4326\"]],"
463+
+ "PROJECTION[\"Polar_Stereographic\"],"
464+
+ "PARAMETER[\"latitude_of_origin\",90],"
465+
+ "PARAMETER[\"central_meridian\",0],"
466+
+ "PARAMETER[\"scale_factor\",0.994],"
467+
+ "PARAMETER[\"false_easting\",2000000],"
468+
+ "PARAMETER[\"false_northing\",2000000]," + "UNIT[\"metre\",1,"
469+
+ "AUTHORITY[\"EPSG\",\"9001\"]],"
470+
+ "AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],"
471+
+ "AUTHORITY[\"EPSG\",\"5041\"]]";
472+
473+
projectionTestDerived(code, definition);
474+
475+
definition = "PROJCRS[\"WGS 84 / UPS North (E,N)\","
476+
+ "BASEGEODCRS[\"WGS 84\","
477+
+ "DATUM[\"World Geodetic System 1984\","
478+
+ "ELLIPSOID[\"WGS 84\",6378137,298.257223563,"
479+
+ "LENGTHUNIT[\"metre\",1.0]]]],"
480+
+ "CONVERSION[\"Universal Polar Stereographic North\","
481+
+ "METHOD[\"Polar Stereographic (variant A)\",ID[\"EPSG\",\"9810\"]],"
482+
+ "PARAMETER[\"Latitude of natural origin\",90,"
483+
+ "ANGLEUNIT[\"degree\",0.0174532925199433]],"
484+
+ "PARAMETER[\"Longitude of natural origin\",0,"
485+
+ "ANGLEUNIT[\"degree\",0.0174532925199433]],"
486+
+ "PARAMETER[\"Scale factor at natural origin\",0.994,"
487+
+ "SCALEUNIT[\"unity\",1.0]],"
488+
+ "PARAMETER[\"False easting\",2000000,"
489+
+ "LENGTHUNIT[\"metre\",1.0]],"
490+
+ "PARAMETER[\"False northing\",2000000,"
491+
+ "LENGTHUNIT[\"metre\",1.0]],ID[\"EPSG\",\"16061\"]],"
492+
+ "CS[Cartesian,2],AXIS[\"Easting (E)\",south,"
493+
+ "MERIDIAN[90,ANGLEUNIT[\"degree\",0.0174532925199433]],"
494+
+ "ORDER[1]],AXIS[\"Northing (N)\",south,"
495+
+ "MERIDIAN[180,ANGLEUNIT[\"degree\",0.0174532925199433]],"
496+
+ "ORDER[2]],LENGTHUNIT[\"metre\",1.0],"
497+
+ "ID[\"EPSG\",\"5041\"]]";
498+
499+
projectionTestDerived(code, definition);
500+
501+
}
502+
422503
/**
423504
* Test projection creation and transformations with derived authority and
424505
* epsg

0 commit comments

Comments
 (0)