Skip to content

Commit 28d2ace

Browse files
committed
utm projections, map projection compat name
1 parent b703388 commit 28d2ace

5 files changed

Lines changed: 364 additions & 56 deletions

File tree

src/main/java/mil/nga/crs/wkt/CRSReader.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import mil.nga.crs.parametric.ParametricDatum;
6464
import mil.nga.crs.projected.MapProjection;
6565
import mil.nga.crs.projected.MapProjectionMethod;
66+
import mil.nga.crs.projected.MapProjectionMethods;
6667
import mil.nga.crs.projected.MapProjectionParameter;
6768
import mil.nga.crs.projected.ProjectedCoordinateReferenceSystem;
6869
import mil.nga.crs.temporal.TemporalCoordinateReferenceSystem;
@@ -4028,6 +4029,19 @@ public ProjectedCoordinateReferenceSystem readProjectedCompat(
40284029

40294030
readSeparator();
40304031
MapProjection mapProjection = readMapProjectionCompat();
4032+
4033+
String mapProjectionName = crs.getName();
4034+
if (!mapProjectionName.toLowerCase()
4035+
.contains(mapProjection.getName().toLowerCase())) {
4036+
MapProjectionMethod method = mapProjection.getMethod();
4037+
if (!method.hasMethod()
4038+
|| method.getMethod() != MapProjectionMethods
4039+
.getMethod(mapProjectionName)) {
4040+
mapProjectionName += " / " + mapProjection.getName();
4041+
}
4042+
}
4043+
mapProjection.setName(mapProjectionName);
4044+
40314045
crs.setMapProjection(mapProjection);
40324046

40334047
crs.setCoordinateSystem(readCoordinateSystemCompat(CRSType.PROJECTED,

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,12 @@ public static Projection createProjection(CoordinateSystem coordinateSystem,
371371

372372
case TRANSVERSE_MERCATOR:
373373
case TRANSVERSE_MERCATOR_SOUTH_ORIENTATED:
374-
projectionName = "tmerc";
374+
if (mapProjection.getName().toLowerCase()
375+
.contains("utm zone")) {
376+
projectionName = "utm";
377+
} else {
378+
projectionName = "tmerc";
379+
}
375380
break;
376381

377382
default:

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void test3035() throws IOException {
8888
+ "PRIMEM[\"Greenwich\",0.0,ID[\"EPSG\",8901]],"
8989
+ "UNIT[\"degree\",0.01745329251994328,"
9090
+ "ID[\"EPSG\",9122]],ID[\"EPSG\",4258]],"
91-
+ "CONVERSION[\"Lambert_Azimuthal_Equal_Area\",METHOD[\"Lambert_Azimuthal_Equal_Area\"],"
91+
+ "CONVERSION[\"ETRS89 / ETRS-LAEA / Lambert_Azimuthal_Equal_Area\",METHOD[\"Lambert_Azimuthal_Equal_Area\"],"
9292
+ "PARAMETER[\"latitude_of_center\",52.0],"
9393
+ "PARAMETER[\"longitude_of_center\",10.0],"
9494
+ "PARAMETER[\"false_easting\",4321000.0],"
@@ -126,7 +126,7 @@ public void test3035() throws IOException {
126126
+ "PRIMEM[\"Greenwich\",0.0,ID[\"EPSG\",8901]],"
127127
+ "UNIT[\"degree\",0.0174532925199433,"
128128
+ "ID[\"EPSG\",9122]],ID[\"EPSG\",4258]],"
129-
+ "CONVERSION[\"Lambert_Azimuthal_Equal_Area\",METHOD[\"Lambert_Azimuthal_Equal_Area\"],"
129+
+ "CONVERSION[\"ETRS89 / LAEA Europe / Lambert_Azimuthal_Equal_Area\",METHOD[\"Lambert_Azimuthal_Equal_Area\"],"
130130
+ "PARAMETER[\"latitude_of_center\",52.0],"
131131
+ "PARAMETER[\"longitude_of_center\",10.0],"
132132
+ "PARAMETER[\"false_easting\",4321000.0],"
@@ -165,7 +165,7 @@ public void test3035() throws IOException {
165165
+ "PRIMEM[\"Greenwich\",0.0,ID[\"EPSG\",8901]],"
166166
+ "UNIT[\"degree\",0.0174532925199433,"
167167
+ "ID[\"EPSG\",9122]],ID[\"EPSG\",4258]],"
168-
+ "CONVERSION[\"Lambert_Azimuthal_Equal_Area\",METHOD[\"Lambert_Azimuthal_Equal_Area\"],"
168+
+ "CONVERSION[\"ETRS89 / LAEA Europe / Lambert_Azimuthal_Equal_Area\",METHOD[\"Lambert_Azimuthal_Equal_Area\"],"
169169
+ "PARAMETER[\"latitude_of_center\",52.0],"
170170
+ "PARAMETER[\"longitude_of_center\",10.0],"
171171
+ "PARAMETER[\"false_easting\",4321000.0],"
@@ -204,7 +204,7 @@ public void test3035() throws IOException {
204204
+ "PRIMEM[\"Greenwich\",0.0,ID[\"EPSG\",8901]],"
205205
+ "UNIT[\"degree\",0.0174532925199433,"
206206
+ "ID[\"EPSG\",9122]],ID[\"EPSG\",4258]],"
207-
+ "CONVERSION[\"Lambert_Azimuthal_Equal_Area\",METHOD[\"Lambert_Azimuthal_Equal_Area\"],"
207+
+ "CONVERSION[\"ETRS89 / LAEA Europe / Lambert_Azimuthal_Equal_Area\",METHOD[\"Lambert_Azimuthal_Equal_Area\"],"
208208
+ "PARAMETER[\"latitude_of_center\",52.0],"
209209
+ "PARAMETER[\"longitude_of_center\",10.0],"
210210
+ "PARAMETER[\"false_easting\",4321000.0],"
@@ -286,7 +286,7 @@ public void test3395() throws IOException {
286286
+ "PRIMEM[\"Greenwich\",0.0,ID[\"EPSG\",8901]],"
287287
+ "UNIT[\"degree\",0.01745329251994328,"
288288
+ "ID[\"EPSG\",9122]],ID[\"EPSG\",4326]],"
289-
+ "CONVERSION[\"Mercator_1SP\",METHOD[\"Mercator_1SP\"],"
289+
+ "CONVERSION[\"WGS 84 / World Mercator / Mercator_1SP\",METHOD[\"Mercator_1SP\"],"
290290
+ "PARAMETER[\"central_meridian\",0.0],"
291291
+ "PARAMETER[\"scale_factor\",1.0],"
292292
+ "PARAMETER[\"false_easting\",0.0],"
@@ -470,7 +470,7 @@ public void test3857() throws IOException {
470470
+ "PRIMEM[\"Greenwich\",0.0,ID[\"EPSG\",8901]],"
471471
+ "UNIT[\"degree\",0.0174532925199433,"
472472
+ "ID[\"EPSG\",9122]],ID[\"EPSG\",4326]],"
473-
+ "CONVERSION[\"Mercator_1SP\",METHOD[\"Mercator_1SP\"],"
473+
+ "CONVERSION[\"WGS 84 / Pseudo-Mercator / Mercator_1SP\",METHOD[\"Mercator_1SP\"],"
474474
+ "PARAMETER[\"central_meridian\",0.0],"
475475
+ "PARAMETER[\"scale_factor\",1.0],"
476476
+ "PARAMETER[\"false_easting\",0.0],"
@@ -508,7 +508,7 @@ public void test3857() throws IOException {
508508
+ "PRIMEM[\"Greenwich\",0.0,ID[\"EPSG\",8901]],"
509509
+ "UNIT[\"degree\",0.0174532925199433,"
510510
+ "ID[\"EPSG\",9122]],ID[\"EPSG\",4326]],"
511-
+ "CONVERSION[\"Mercator_1SP\",METHOD[\"Mercator_1SP\"],"
511+
+ "CONVERSION[\"WGS 84 / Pseudo-Mercator / Mercator_1SP\",METHOD[\"Mercator_1SP\"],"
512512
+ "PARAMETER[\"central_meridian\",0.0],"
513513
+ "PARAMETER[\"scale_factor\",1.0],"
514514
+ "PARAMETER[\"false_easting\",0.0],"
@@ -586,7 +586,7 @@ public void test3978() throws IOException {
586586
+ "PRIMEM[\"Greenwich\",0.0,ID[\"EPSG\",8901]],"
587587
+ "UNIT[\"degree\",0.0174532925199433,"
588588
+ "ID[\"EPSG\",9122]],ID[\"EPSG\",4269]],"
589-
+ "CONVERSION[\"Lambert_Conformal_Conic_2SP\",METHOD[\"Lambert_Conformal_Conic_2SP\"],"
589+
+ "CONVERSION[\"NAD83 / Canada Atlas Lambert / Lambert_Conformal_Conic_2SP\",METHOD[\"Lambert_Conformal_Conic_2SP\"],"
590590
+ "PARAMETER[\"standard_parallel_1\",49.0],"
591591
+ "PARAMETER[\"standard_parallel_2\",77.0],"
592592
+ "PARAMETER[\"latitude_of_origin\",49.0],"
@@ -631,7 +631,7 @@ public void test3978() throws IOException {
631631
+ "PRIMEM[\"Greenwich\",0.0,ID[\"EPSG\",8901]],"
632632
+ "UNIT[\"degree\",0.0174532925199433,ID[\"EPSG\",9122]],"
633633
+ "ID[\"EPSG\",4269]],"
634-
+ "CONVERSION[\"Lambert_Conformal_Conic_2SP\",METHOD[\"Lambert_Conformal_Conic_2SP\"],"
634+
+ "CONVERSION[\"NAD83 / Canada Atlas Lambert / Lambert_Conformal_Conic_2SP\",METHOD[\"Lambert_Conformal_Conic_2SP\"],"
635635
+ "PARAMETER[\"standard_parallel_1\",49.0],"
636636
+ "PARAMETER[\"standard_parallel_2\",77.0],"
637637
+ "PARAMETER[\"latitude_of_origin\",49.0],"
@@ -876,7 +876,7 @@ public void test5041() throws IOException {
876876
+ "PRIMEM[\"Greenwich\",0.0,ID[\"EPSG\",8901]],"
877877
+ "UNIT[\"degree\",0.0174532925199433,ID[\"EPSG\",9122]],"
878878
+ "ID[\"EPSG\",4326]],"
879-
+ "CONVERSION[\"Polar_Stereographic\",METHOD[\"Polar_Stereographic\"],"
879+
+ "CONVERSION[\"WGS 84 / UPS North (E,N) / Polar_Stereographic\",METHOD[\"Polar_Stereographic\"],"
880880
+ "PARAMETER[\"latitude_of_origin\",90.0],PARAMETER[\"central_meridian\",0.0],"
881881
+ "PARAMETER[\"scale_factor\",0.994],PARAMETER[\"false_easting\",2000000.0],"
882882
+ "PARAMETER[\"false_northing\",2000000.0]],"
@@ -893,7 +893,7 @@ public void test5041() throws IOException {
893893
+ "DATUM[\"World Geodetic System 1984\","
894894
+ "ELLIPSOID[\"WGS 84\",6378137,298.257223563,"
895895
+ "LENGTHUNIT[\"metre\",1.0]]]],"
896-
+ "CONVERSION[\"Universal Polar Stereographic North\","
896+
+ "CONVERSION[\"WGS 84 / UPS North (E,N) / Universal Polar Stereographic North\","
897897
+ "METHOD[\"Polar Stereographic (variant A)\",ID[\"EPSG\",\"9810\"]],"
898898
+ "PARAMETER[\"Latitude of natural origin\",90,"
899899
+ "ANGLEUNIT[\"degree\",0.0174532925199433]],"
@@ -997,7 +997,7 @@ public void test5042() throws IOException {
997997
+ "PRIMEM[\"Greenwich\",0.0,ID[\"EPSG\",8901]],"
998998
+ "UNIT[\"degree\",0.0174532925199433,"
999999
+ "ID[\"EPSG\",9122]],ID[\"EPSG\",4326]],"
1000-
+ "CONVERSION[\"Polar_Stereographic\",METHOD[\"Polar_Stereographic\"],"
1000+
+ "CONVERSION[\"WGS 84 / UPS South (E,N) / Polar_Stereographic\",METHOD[\"Polar_Stereographic\"],"
10011001
+ "PARAMETER[\"latitude_of_origin\",-90.0],"
10021002
+ "PARAMETER[\"central_meridian\",0.0],"
10031003
+ "PARAMETER[\"scale_factor\",0.994],"
@@ -1293,7 +1293,7 @@ public void test7405() throws IOException {
12931293
+ "PRIMEM[\"Greenwich\",0.0,ID[\"EPSG\",8901]],"
12941294
+ "UNIT[\"degree\",0.0174532925199433,"
12951295
+ "ID[\"EPSG\",9122]],ID[\"EPSG\",4277]],"
1296-
+ "CONVERSION[\"Transverse_Mercator\",METHOD[\"Transverse_Mercator\"],"
1296+
+ "CONVERSION[\"OSGB 1936 / British National Grid / Transverse_Mercator\",METHOD[\"Transverse_Mercator\"],"
12971297
+ "PARAMETER[\"latitude_of_origin\",49.0],"
12981298
+ "PARAMETER[\"central_meridian\",-2.0],"
12991299
+ "PARAMETER[\"scale_factor\",0.9996012717],"
@@ -1346,7 +1346,7 @@ public void test9801() throws IOException {
13461346
+ "ELLIPSOID[\"GRS_1980\",6371000.0,0.0]],"
13471347
+ "PRIMEM[\"Greenwich\",0.0],"
13481348
+ "UNIT[\"Degree\",0.017453292519943295]],"
1349-
+ "CONVERSION[\"Lambert_Conformal_Conic_1SP\",METHOD[\"Lambert_Conformal_Conic_1SP\"],"
1349+
+ "CONVERSION[\"Lambert_Conformal_Conic (1SP) / Lambert_Conformal_Conic_1SP\",METHOD[\"Lambert_Conformal_Conic_1SP\"],"
13501350
+ "PARAMETER[\"latitude_of_origin\",25.0],"
13511351
+ "PARAMETER[\"central_meridian\",-95.0],"
13521352
+ "PARAMETER[\"scale_factor\",1.0],"
@@ -1394,7 +1394,7 @@ public void test9802() throws IOException {
13941394
+ "ELLIPSOID[\"GRS_1980\",6378160.0,298.2539162964695]],"
13951395
+ "PRIMEM[\"Greenwich\",0.0],"
13961396
+ "UNIT[\"degree\",0.0174532925199433]],"
1397-
+ "CONVERSION[\"Lambert_Conformal_Conic_2SP\",METHOD[\"Lambert_Conformal_Conic_2SP\"],"
1397+
+ "CONVERSION[\"Lambert Conic Conformal (2SP)\",METHOD[\"Lambert_Conformal_Conic_2SP\"],"
13981398
+ "PARAMETER[\"standard_parallel_1\",30.0],"
13991399
+ "PARAMETER[\"standard_parallel_2\",60.0],"
14001400
+ "PARAMETER[\"latitude_of_origin\",30.0],"
@@ -1477,7 +1477,7 @@ public void test32660() throws IOException {
14771477
+ "PRIMEM[\"Greenwich\",0.0,ID[\"EPSG\",8901]],"
14781478
+ "UNIT[\"degree\",0.01745329251994328,"
14791479
+ "ID[\"EPSG\",9122]],ID[\"EPSG\",4326]],"
1480-
+ "CONVERSION[\"Transverse_Mercator\",METHOD[\"Transverse_Mercator\"],"
1480+
+ "CONVERSION[\"WGS 84 / UTM zone 60N / Transverse_Mercator\",METHOD[\"Transverse_Mercator\"],"
14811481
+ "PARAMETER[\"latitude_of_origin\",0.0],"
14821482
+ "PARAMETER[\"central_meridian\",177.0],"
14831483
+ "PARAMETER[\"scale_factor\",0.9996],"
@@ -1517,7 +1517,7 @@ public void test32660() throws IOException {
15171517
+ "PRIMEM[\"Greenwich\",0.0,ID[\"EPSG\",8901]],"
15181518
+ "UNIT[\"degree\",0.0174532925199433,ID[\"EPSG\",9122]],"
15191519
+ "ID[\"EPSG\",4326]],"
1520-
+ "CONVERSION[\"Transverse_Mercator\",METHOD[\"Transverse_Mercator\"],"
1520+
+ "CONVERSION[\"WGS 84 / UTM zone 60N / Transverse_Mercator\",METHOD[\"Transverse_Mercator\"],"
15211521
+ "PARAMETER[\"latitude_of_origin\",0.0],"
15221522
+ "PARAMETER[\"central_meridian\",177.0],"
15231523
+ "PARAMETER[\"scale_factor\",0.9996],"

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5674,7 +5674,7 @@ public void testProjectedCompat() throws IOException {
56745674
projectedCrs.getReferenceFrame().getPrimeMeridian().getName());
56755675
assertEquals(0, projectedCrs.getReferenceFrame().getPrimeMeridian()
56765676
.getLongitude(), 0);
5677-
assertEquals("Transverse Mercator",
5677+
assertEquals("NAD83 / UTM zone 10N / Transverse Mercator",
56785678
projectedCrs.getMapProjection().getName());
56795679
assertEquals("Transverse Mercator",
56805680
projectedCrs.getMapProjection().getMethod().getName());
@@ -5709,7 +5709,7 @@ public void testProjectedCompat() throws IOException {
57095709
+ "DATUM[\"North American Datum 1983\","
57105710
+ "ELLIPSOID[\"GRS 1980\",6378137.0,298.257222101]],"
57115711
+ "PRIMEM[\"Greenwich\",0.0]],"
5712-
+ "CONVERSION[\"Transverse Mercator\",METHOD[\"Transverse Mercator\"],"
5712+
+ "CONVERSION[\"NAD83 / UTM zone 10N / Transverse Mercator\",METHOD[\"Transverse Mercator\"],"
57135713
+ "PARAMETER[\"Latitude of origin\",0.0],"
57145714
+ "PARAMETER[\"Longitude of origin\",-123.0],"
57155715
+ "PARAMETER[\"Scale factor\",0.9996],"
@@ -5756,7 +5756,8 @@ public void testProjectedCompat() throws IOException {
57565756
projectedCrs.getReferenceFrame().getPrimeMeridian().getName());
57575757
assertEquals(0, projectedCrs.getReferenceFrame().getPrimeMeridian()
57585758
.getLongitude(), 0);
5759-
assertEquals("UTM zone 10N", projectedCrs.getMapProjection().getName());
5759+
assertEquals("NAD83 / UTM zone 10N",
5760+
projectedCrs.getMapProjection().getName());
57605761
assertEquals("UTM zone 10N",
57615762
projectedCrs.getMapProjection().getMethod().getName());
57625763
assertEquals("Latitude of origin", projectedCrs.getMapProjection()
@@ -5790,7 +5791,7 @@ public void testProjectedCompat() throws IOException {
57905791
+ "DATUM[\"North American Datum 1983\","
57915792
+ "ELLIPSOID[\"GRS 1980\",6378137.0,298.257222101]],"
57925793
+ "PRIMEM[\"Greenwich\",0.0]],"
5793-
+ "CONVERSION[\"UTM zone 10N\",METHOD[\"UTM zone 10N\"],"
5794+
+ "CONVERSION[\"NAD83 / UTM zone 10N\",METHOD[\"UTM zone 10N\"],"
57945795
+ "PARAMETER[\"Latitude of origin\",0.0],"
57955796
+ "PARAMETER[\"Longitude of origin\",-123.0],"
57965797
+ "PARAMETER[\"Scale factor at natural origin\",0.9996],"

0 commit comments

Comments
 (0)