Skip to content

Commit 7d23155

Browse files
committed
proj parser test
1 parent 9d2b337 commit 7d23155

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

src/test/java/mil/nga/crs/util/proj/ProjParserTest.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,64 @@ public void test2046() throws IOException {
118118

119119
}
120120

121+
/**
122+
* Test EPSG 2056
123+
*
124+
* @throws IOException
125+
* upon error
126+
*/
127+
@Test
128+
public void test2056() throws IOException {
129+
130+
// +proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1
131+
// +x_0=2600000 +y_0=1200000 +ellps=bessel
132+
// +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs
133+
134+
String definition = "PROJCRS[\"CH1903+ / LV95\",BASEGEOGCRS[\"CH1903+\",DATUM[\"CH1903+\","
135+
+ "ELLIPSOID[\"Bessel 1841\",6377397.155,299.1528128,LENGTHUNIT[\"metre\",1,ID[\"EPSG\",9001]],ID[\"EPSG\",7004]],"
136+
+ "ID[\"EPSG\",6150]],ID[\"EPSG\",4150]],"
137+
+ "CONVERSION[\"Swiss Oblique Mercator 1995\",METHOD[\"Hotine Oblique Mercator (variant B)\",ID[\"EPSG\",9815]],"
138+
+ "PARAMETER[\"Latitude of projection centre\",46.952405556,ANGLEUNIT[\"degree\",0.0174532925199433,ID[\"EPSG\",9102]]],"
139+
+ "PARAMETER[\"Longitude of projection centre\",7.439583333,ANGLEUNIT[\"degree\",0.0174532925199433,ID[\"EPSG\",9102]]],"
140+
+ "PARAMETER[\"Azimuth of initial line\",90,ANGLEUNIT[\"degree\",0.0174532925199433,ID[\"EPSG\",9102]]],"
141+
+ "PARAMETER[\"Angle from Rectified to Skew Grid\",90,ANGLEUNIT[\"degree\",0.0174532925199433,ID[\"EPSG\",9102]]],"
142+
+ "PARAMETER[\"Scale factor on initial line\",1,SCALEUNIT[\"unity\",1,ID[\"EPSG\",9201]]],"
143+
+ "PARAMETER[\"Easting at projection centre\",2600000,LENGTHUNIT[\"metre\",1,ID[\"EPSG\",9001]]],"
144+
+ "PARAMETER[\"Northing at projection centre\",1200000,LENGTHUNIT[\"metre\",1,ID[\"EPSG\",9001]]],"
145+
+ "PARAMETER[\"X-axis translation\",674.374,LENGTHUNIT[\"metre\",1.0]],"
146+
+ "PARAMETER[\"Y-axis translation\",15.056,LENGTHUNIT[\"metre\",1.0]],"
147+
+ "PARAMETER[\"Z-axis translation\",405.346,LENGTHUNIT[\"metre\",1.0]],"
148+
+ "ID[\"EPSG\",19950]],"
149+
+ "CS[Cartesian,2,ID[\"EPSG\",4400]],AXIS[\"Easting (E)\",east],AXIS[\"Northing (N)\",north],"
150+
+ "LENGTHUNIT[\"metre\",1,ID[\"EPSG\",9001]],ID[\"EPSG\",2056]]";
151+
152+
String expected = "+proj=somerc +lat_0=46.952405556 +lon_0=7.439583333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs";
153+
assertEquals(expected, ProjParser.paramsText(definition));
154+
155+
definition = "PROJCS[\"CH1903+ / LV95\"," + "GEOGCS[\"CH1903+\","
156+
+ "DATUM[\"CH1903+\","
157+
+ "SPHEROID[\"Bessel 1841\",6377397.155,299.1528128,"
158+
+ "AUTHORITY[\"EPSG\",\"7004\"]],"
159+
+ "TOWGS84[674.374,15.056,405.346,0,0,0,0],"
160+
+ "AUTHORITY[\"EPSG\",\"6150\"]]," + "PRIMEM[\"Greenwich\",0,"
161+
+ "AUTHORITY[\"EPSG\",\"8901\"]],"
162+
+ "UNIT[\"degree\",0.0174532925199433,"
163+
+ "AUTHORITY[\"EPSG\",\"9122\"]],"
164+
+ "AUTHORITY[\"EPSG\",\"4150\"]],"
165+
+ "PROJECTION[\"Hotine_Oblique_Mercator_Azimuth_Center\"],"
166+
+ "PARAMETER[\"latitude_of_center\",46.95240555555556],"
167+
+ "PARAMETER[\"longitude_of_center\",7.439583333333333],"
168+
+ "PARAMETER[\"azimuth\",90],"
169+
+ "PARAMETER[\"rectified_grid_angle\",90],"
170+
+ "PARAMETER[\"scale_factor\",1],"
171+
+ "PARAMETER[\"false_easting\",2600000],"
172+
+ "PARAMETER[\"false_northing\",1200000]," + "UNIT[\"metre\",1,"
173+
+ "AUTHORITY[\"EPSG\",\"9001\"]]," + "AXIS[\"Y\",EAST],"
174+
+ "AXIS[\"X\",NORTH]," + "AUTHORITY[\"EPSG\",\"2056\"]]";
175+
176+
expected = "+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs";
177+
assertEquals(expected, ProjParser.paramsText(definition));
178+
179+
}
180+
121181
}

0 commit comments

Comments
 (0)