@@ -374,7 +374,7 @@ public boolean test(HMStacAsset asset) { // Assuming for now that "eo:bands" wou
374374 predicate = getAssetPredicate (resource );
375375 } catch (KlabIllegalArgumentException e ) {
376376 manager .close ();
377- throw e ;
377+ throw e ;
378378 }
379379 HMRaster outRaster = collection .readRasterBandOnRegion (regionTransformed , predicate , items , true ,
380380 MergeMode .SUBSTITUTE , lpm );
@@ -450,7 +450,7 @@ public boolean test(HMStacAsset asset) { // Assuming for now that "eo:bands" wou
450450 List <HMStacItem > items = collection .searchItems ();
451451 if (items .isEmpty ()) {
452452 manager .close ();
453- throw new KlabIllegalStateException ("No STAC items found for this context. " );
453+ throw new KlabIllegalStateException ("No STAC items found for this context, check the Spatial/ Temporal bounds of items and the Context " );
454454 }
455455
456456 if (mergeMode == HMRaster .MergeMode .SUBSTITUTE ) {
@@ -501,10 +501,10 @@ public boolean test(HMStacAsset asset) { // Assuming for now that "eo:bands" wou
501501 }
502502
503503 HMRaster outRaster = collection .readRasterBandOnRegion (regionTransformed , assetPredicate , items , allowTransform ,
504- MergeMode .SUBSTITUTE , lpm );
504+ MergeMode .SUBSTITUTE , lpm );
505505 if (outRaster == null ) {
506- scope .getMonitor ().error ("No STAC assets were found. Please check the spatial/temporal coverage of the resource " );
507- throw new KlabIllegalStateException ("No STAC assets were found. Please check the spatial/temporal coverage of the resource " );
506+ scope .getMonitor ().error ("Unable to build the output from the STAC Resource " );
507+ throw new KlabIllegalStateException ("Unable to build the output from the STAC Resource " );
508508 }
509509 CoordinateReferenceSystem targetCRS = HMCrsRegistry .INSTANCE .getCrs ("4326" );
510510 if (!HMCrsRegistry .crsEquals (outRaster .getCrs (),targetCRS )) {
@@ -513,8 +513,13 @@ public boolean test(HMStacAsset asset) { // Assuming for now that "eo:bands" wou
513513 outRaster = transformer .transform (outRaster );
514514 }
515515
516- coverage = outRaster .buildCoverage ();
517- if (bandIndex != null ) { // Which means theat it's a Multi Band COG
516+
517+ HMRaster paddedRaster = new HMRasterWritableBuilder ().setName ("padded" ).setRegion (region )
518+ .setCrs (targetCRS ).setNoValue (outRaster .getNovalue ()).build ();
519+ paddedRaster .mapRaster (null , outRaster , null );
520+ coverage = paddedRaster .buildCoverage ();
521+
522+ if (bandIndex != null ) { // Which means theat it's a Multi Band COG
518523 coverage = (GridCoverage2D ) Operations .DEFAULT .selectSampleDimension (coverage , new int []{bandIndex });
519524 }
520525
0 commit comments