From 292afa02812903dd9c6f2b2ff0520671f6e5a825 Mon Sep 17 00:00:00 2001 From: Jeroen Dries Date: Wed, 12 Jun 2024 12:45:08 +0200 Subject: [PATCH] make key filtering work for spacetimekey https://github.com/Open-EO/openeo-geotrellis-extensions/issues/305 --- .../scala/org/openeo/geotrellis/OpenEOProcesses.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openeo-geotrellis/src/main/scala/org/openeo/geotrellis/OpenEOProcesses.scala b/openeo-geotrellis/src/main/scala/org/openeo/geotrellis/OpenEOProcesses.scala index a28e92a9c..c87df32d0 100644 --- a/openeo-geotrellis/src/main/scala/org/openeo/geotrellis/OpenEOProcesses.scala +++ b/openeo-geotrellis/src/main/scala/org/openeo/geotrellis/OpenEOProcesses.scala @@ -760,7 +760,15 @@ class OpenEOProcesses extends Serializable { def filterNegativeSpatialKeys[K: SpatialComponent: ClassTag ](data: MultibandTileLayerRDD[K]):MultibandTileLayerRDD[K] = { val filtered = data.filter( tuple => { - val sKey = tuple._1.getComponent[SpatialKey] + val sKey = + tuple._1 match { + case key: SpatialKey => + key + case key:SpaceTimeKey => + key.spatialKey + case key: Any => + throw new IllegalArgumentException(s"Unsupported key type: $key") + } if(sKey.col<0 || sKey.row<0){ logger.debug("Preemptively filtering negative spatial key: " + sKey) false