|
18 | 18 | import mil.nga.crs.parametric.ParametricCoordinateReferenceSystem; |
19 | 19 | import mil.nga.crs.projected.ProjectedCoordinateReferenceSystem; |
20 | 20 | import mil.nga.crs.temporal.TemporalCoordinateReferenceSystem; |
| 21 | +import mil.nga.crs.util.proj.ProjParams; |
| 22 | +import mil.nga.crs.util.proj.ProjParser; |
21 | 23 | import mil.nga.crs.vertical.VerticalCoordinateReferenceSystem; |
22 | 24 | import mil.nga.crs.wkt.CRSReader; |
23 | 25 | import mil.nga.crs.wkt.CRSWriter; |
@@ -51,8 +53,11 @@ public void testCRS() throws IOException { |
51 | 53 | + "AXIS[\"Geodetic latitude (Lat)\",north],AXIS[\"Geodetic longitude (Lon)\",east]," |
52 | 54 | + "ANGLEUNIT[\"degree\",0.0174532925199433,ID[\"EPSG\",9102]]," |
53 | 55 | + "ID[\"EPSG\",4326]]"; |
| 56 | + |
54 | 57 | assertEquals(wkt, testCRS(wkt)); |
55 | 58 |
|
| 59 | + assertEquals("+proj=longlat +datum=WGS84 +no_defs", testProj(wkt)); |
| 60 | + |
56 | 61 | } |
57 | 62 |
|
58 | 63 | /** |
@@ -161,4 +166,27 @@ private String testCRS(String wkt) throws IOException { |
161 | 166 | return text; |
162 | 167 | } |
163 | 168 |
|
| 169 | + /** |
| 170 | + * Test proj |
| 171 | + * |
| 172 | + * @param wkt |
| 173 | + * crs well-known text |
| 174 | + * @return PROJ text |
| 175 | + * @throws IOException |
| 176 | + * upon failure |
| 177 | + */ |
| 178 | + private String testProj(String wkt) throws IOException { |
| 179 | + |
| 180 | + // String wkt = ... |
| 181 | + |
| 182 | + CRS crs = CRSReader.read(wkt); |
| 183 | + |
| 184 | + ProjParams projParamsFromCRS = ProjParser.params(crs); |
| 185 | + String projTextFromCRS = ProjParser.paramsText(crs); |
| 186 | + ProjParams projParamsFromWKT = ProjParser.params(wkt); |
| 187 | + String projTextFromWKT = ProjParser.paramsText(wkt); |
| 188 | + |
| 189 | + return projTextFromWKT; |
| 190 | + } |
| 191 | + |
164 | 192 | } |
0 commit comments