From aeadae228c15a08b93dec73bb9fbd0fb5c792387 Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Mon, 22 Jan 2024 19:23:06 -0700 Subject: [PATCH] Fix wms epsg database not loading (#457) * Add wms get map test for projection requiring epsg database * EpsgDatabasePath should not be a URI and add log info --- .../java/thredds/server/wms/TestWmsServer.java | 14 ++++++++++++++ .../main/java/thredds/server/config/TdsInit.java | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tds/src/integrationTests/java/thredds/server/wms/TestWmsServer.java b/tds/src/integrationTests/java/thredds/server/wms/TestWmsServer.java index 126039b3dd..1e12bdb06a 100644 --- a/tds/src/integrationTests/java/thredds/server/wms/TestWmsServer.java +++ b/tds/src/integrationTests/java/thredds/server/wms/TestWmsServer.java @@ -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) diff --git a/tds/src/main/java/thredds/server/config/TdsInit.java b/tds/src/main/java/thredds/server/config/TdsInit.java index 5fb007afa4..dfba33dd63 100644 --- a/tds/src/main/java/thredds/server/config/TdsInit.java +++ b/tds/src/main/java/thredds/server/config/TdsInit.java @@ -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"); } }