Skip to content

Commit

Permalink
Fix wms epsg database not loading (#457)
Browse files Browse the repository at this point in the history
* Add wms get map test for projection requiring epsg database

* EpsgDatabasePath should not be a URI and add log info
  • Loading branch information
tdrwenski authored Jan 23, 2024
1 parent d0c6e83 commit aeadae2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ public void testGetPng() {
TestOnLocalServer.withHttpPath("/wms/scanCdmUnitTests/conventions/cf/ipcc/tas_A1.nc?service=WMS&version=1.3.0"
+ "&request=GetMap&CRS=CRS:84&WIDTH=512&HEIGHT=512&LAYERS=tas&BBOX=0,-90,360,90&format="
+ ContentType.png.toString() + "&time=1850-01-16T12:00:00Z");
testGetPng(endpoint);
}

@Test
@Category(NeedsCdmUnitTest.class)
public void testGetPngInAnotherProjection() {
String endpoint =
TestOnLocalServer.withHttpPath("/wms/scanCdmUnitTests/conventions/cf/ipcc/tas_A1.nc?service=WMS&version=1.3.0"
+ "&request=GetMap&CRS=EPSG:3857&WIDTH=512&HEIGHT=512&LAYERS=tas&BBOX=0,-90,360,90&format="
+ ContentType.png.toString() + "&time=1850-01-16T12:00:00Z");
testGetPng(endpoint);
}

private static void testGetPng(String endpoint) {
byte[] result = TestOnLocalServer.getContent(endpoint, HttpServletResponse.SC_OK, ContentType.png.toString());
// make sure we get a png back
// first byte (unsigned) should equal 137 (decimal)
Expand Down
4 changes: 2 additions & 2 deletions tds/src/main/java/thredds/server/config/TdsInit.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ public void onApplicationEvent(ContextRefreshedEvent event) {
configCatalogInitializer.init(readMode, (PreferencesExt) mainPrefs.node("configCatalog"));

// set epsg database location for edal-java (comes from apache-sis)
EpsgDatabasePath.DB_PATH =
(new File(tdsContext.getThreddsDirectory(), "/cache/edal-java/epsg/").toURI().toString());
EpsgDatabasePath.DB_PATH = (new File(tdsContext.getThreddsDirectory(), "/cache/edal-java/epsg/").getPath());
startupLog.info("EPSG database path: " + EpsgDatabasePath.DB_PATH);
startupLog.info("TdsInit complete");
}
}
Expand Down

0 comments on commit aeadae2

Please sign in to comment.