diff --git a/openeo-geotrellis/src/main/scala/org/openeo/geotrellis/layers/FileLayerProvider.scala b/openeo-geotrellis/src/main/scala/org/openeo/geotrellis/layers/FileLayerProvider.scala index 7f17c5f8..b2a1aa79 100644 --- a/openeo-geotrellis/src/main/scala/org/openeo/geotrellis/layers/FileLayerProvider.scala +++ b/openeo-geotrellis/src/main/scala/org/openeo/geotrellis/layers/FileLayerProvider.scala @@ -28,10 +28,7 @@ import org.apache.spark.util.LongAccumulator import org.locationtech.jts.geom.Geometry import org.openeo.geotrellis.OpenEOProcessScriptBuilder.AnyProcess import org.openeo.geotrellis.file.{AbstractPyramidFactory, FixedFeaturesOpenSearchClient} -import org.openeo.geotrellis.tile_grid.TileGrid import org.openeo.geotrellis.{OpenEOProcessScriptBuilder, healthCheckExtent, sortableSourceName} -import org.openeo.geotrelliscommon.{BatchJobMetadataTracker, ByKeyPartitioner, CloudFilterStrategy, ConfigurableSpatialPartitioner, DataCubeParameters, DatacubeSupport, L1CCloudFilterStrategy, MaskTileLoader, NoCloudFilterStrategy, ResampledTile, SCLConvolutionFilterStrategy, SpaceTimeByMonthPartitioner, SparseSpaceTimePartitioner, autoUtmEpsg, retryForever} -import org.openeo.geotrellis.{OpenEOProcessScriptBuilder, sortableSourceName} import org.openeo.geotrelliscommon.DatacubeSupport.prepareMask import org.openeo.geotrelliscommon.{BatchJobMetadataTracker, ByKeyPartitioner, CloudFilterStrategy, ConfigurableSpatialPartitioner, DataCubeParameters, DatacubeSupport, L1CCloudFilterStrategy, MaskTileLoader, NoCloudFilterStrategy, ResampledTile, SCLConvolutionFilterStrategy, SpaceTimeByMonthPartitioner, SparseSpaceTimePartitioner, autoUtmEpsg} import org.openeo.opensearch.OpenSearchClient diff --git a/openeo-geotrellis/src/test/scala/org/openeo/geotrellis/layers/FileLayerProviderTest.scala b/openeo-geotrellis/src/test/scala/org/openeo/geotrellis/layers/FileLayerProviderTest.scala index c0b53ff4..f6f87dd9 100644 --- a/openeo-geotrellis/src/test/scala/org/openeo/geotrellis/layers/FileLayerProviderTest.scala +++ b/openeo-geotrellis/src/test/scala/org/openeo/geotrellis/layers/FileLayerProviderTest.scala @@ -1140,19 +1140,29 @@ class FileLayerProviderTest extends RasterMatchers{ } @ParameterizedTest - @ValueSource(strings = Array("EPSG:32601", "EPSG:32660")) + @ValueSource(strings = Array("EPSG:32601", "EPSG:32660", "EPSG:3035", "EPSG:4326")) def testMissingS2DateLine(crsName: String): Unit = { - // crsName "EPSG:4326" only works with the environment variable PROJ_LIB=/usr/share/proj + if ((crsName == "EPSG:3035" || crsName == "EPSG:4326") && System.getenv("PROJ_LIB") == null) { + println("PROJ_LIB is not set in the environment variables. Skipping this test") + // A typical value would be: PROJ_LIB=/usr/share/proj + return + } val outDir = Paths.get("tmp/FileLayerProviderTest_" + crsName.replace(":", "_") + "/") new Directory(outDir.toFile).deepFiles.foreach(_.delete()) Files.createDirectories(outDir) - val extent = Extent(178.7384, 70.769, 178.8548, 70.8254) + val extent = Extent(178.1, 70.3, 178.9, 70.9) val projected_polygons_native_crs = ProjectedPolygons.fromExtent(extent, LatLng.proj4jCrs.toString) val utmCrs = CRS.fromName(crsName) val reprojected = projected_polygons_native_crs.polygons.head.reproject(projected_polygons_native_crs.crs, utmCrs) val poly2 = ProjectedPolygons(Array(reprojected), utmCrs) + if (crsName == "EPSG:4326") { + val poly2GeoJson = poly2.polygons.head.toGeoJson + // geojson only officially suports latLon + Files.writeString(Paths.get(outDir + "/polygons.geojson"), poly2GeoJson) + } + val layer = LayerFixtures.sentinel2Cube( LocalDate.of(2024, 4, 2), poly2, @@ -1163,10 +1173,18 @@ class FileLayerProviderTest extends RasterMatchers{ val layer_collected = layer.collect() assert(layer_collected.nonEmpty) + var found10 = false // SCL value for 'snow or ice' for { (_, multiBandTile) <- layer_collected tile <- multiBandTile.bands - } assert(!tile.isNoDataTile) + } { + assert(!tile.isNoDataTile) + val values = tile.toArrayDouble() + if (values.contains(10.0)) { + found10 = true + } + } + assert(found10) val cubeSpatial = layer.toSpatial() cubeSpatial.writeGeoTiff(outDir + "/testMissingS2DateLine_" + crsName.replace(":", "_") + ".tiff") }