From edebcabe3c941d4ff838d0a3f9cf817170a5bd04 Mon Sep 17 00:00:00 2001 From: Emile Sonneveld Date: Fri, 28 Jun 2024 11:59:09 +0200 Subject: [PATCH] Small cleanup --- .../openeo/geotrellis/layers/FileLayerProvider.scala | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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 e9febc48..9ab0332d 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 @@ -1243,13 +1243,11 @@ class FileLayerProvider private(openSearch: OpenSearchClient, openSearchCollecti * - if feature is in utm, target extent may be invalid in feature crs * this is why we take intersection */ - val commonCRS = targetExtent.crs - val targetExtentInCommonCRS = targetExtent.reproject(commonCRS) - val featureExtentInCommonCRS = feature.rasterExtent.get.reproject(feature.crs.get, commonCRS) + val featureExtentInTargetCRS = feature.rasterExtent.get.reproject(feature.crs.get, targetExtent.crs) - val intersection = featureExtentInCommonCRS.intersection(targetExtentInCommonCRS).map(_.buffer(1.0)) - .getOrElse(featureExtentInCommonCRS) - val tmp = expandToCellSize(intersection.reproject(commonCRS, targetExtent.crs), theResolution) + val intersection = featureExtentInTargetCRS.intersection(targetExtent.extent).map(_.buffer(1.0)) + .getOrElse(featureExtentInTargetCRS) + val tmp = expandToCellSize(intersection, theResolution) val alignedToTargetExtent = re.createAlignedRasterExtent(tmp) Some(alignedToTargetExtent.toGridType[Long])