@@ -85,10 +85,10 @@ package object geotiff {
85
85
def saveStitched (rdd : SRDD , path : String , cropBounds : Map [String , Double ], compression : Compression ): Item =
86
86
saveStitched(rdd, path, Some (cropBounds), None , compression)
87
87
88
- def saveStitchedTileGrid (rdd : SRDD , path : String , tileGrid : String , compression : Compression ): JList [( String , Extent ) ] =
88
+ def saveStitchedTileGrid (rdd : SRDD , path : String , tileGrid : String , compression : Compression ): JList [Item ] =
89
89
saveStitchedTileGrid(rdd, path, tileGrid, None , None , compression)
90
90
91
- def saveStitchedTileGrid (rdd : SRDD , path : String , tileGrid : String , cropBounds : Map [String , Double ], compression : Compression ): JList [( String , Extent ) ] =
91
+ def saveStitchedTileGrid (rdd : SRDD , path : String , tileGrid : String , cropBounds : Map [String , Double ], compression : Compression ): JList [Item ] =
92
92
saveStitchedTileGrid(rdd, path, tileGrid, Some (cropBounds), None , compression)
93
93
94
94
def saveRDDTiled (rdd: MultibandTileLayerRDD [SpaceTimeKey ], path: String ,zLevel: Int = 6 ,cropBounds: Option [Extent ]= Option .empty[Extent ]): Unit = {
@@ -850,7 +850,7 @@ package object geotiff {
850
850
cropBounds : Option [Map [String , Double ]],
851
851
cropDimensions : Option [ArrayList [Int ]],
852
852
compression : Compression )
853
- : JList [( String , Extent ) ] = {
853
+ : JList [Item ] = {
854
854
val features = TileGrid .computeFeaturesForTileGrid(tileGrid, ProjectedExtent (rdd.metadata.extent,rdd.metadata.crs))
855
855
856
856
def newFilePath (path : String , tileId : String ) = {
@@ -879,19 +879,25 @@ package object geotiff {
879
879
val executorAttemptDirectory = createExecutorAttemptDirectory(Path .of(path).getParent)
880
880
val filePath = executorAttemptDirectory + " /" + newFilePath(Path .of(path).getFileName.toString, tileId)
881
881
882
- (stitchAndWriteToTiff(tiles, filePath, layout, crs, extent, croppedExtent, cropDimensions, compression), extent)
882
+ (stitchAndWriteToTiff(tiles, filePath, layout, crs, extent, croppedExtent, cropDimensions, compression), tileId, extent)
883
883
}.collect()
884
884
val res = geotiffResults.map {
885
- case (geoTiffResultObject, croppedExtent) =>
885
+ case (geoTiffResultObject, tileId, croppedExtent) =>
886
886
val destinationPath = moveFromExecutorAttemptDirectory(Path .of(path).getParent, geoTiffResultObject)
887
- (destinationPath.toString, croppedExtent)
888
- }.toList.asJava
889
- for ((geotiffResult, _) <- geotiffResults) {
887
+ (destinationPath, tileId, croppedExtent)
888
+ }
889
+
890
+ val items = res.map { case (path, tileId, extent) =>
891
+ Item (id = s " ${UUID .randomUUID()}_ $tileId" , datetime = null , bbox = extent,
892
+ assets = Collections .singletonMap(" openEO" , Asset (path)))
893
+ }
894
+
895
+ for ((geotiffResult, _, _) <- geotiffResults) {
890
896
val successfulExecutorAttemptDirectory = extractExecutorAttemptDirectory(Path .of(path).getParent, geotiffResult)
891
897
CreoS3Utils .assetDeleteFolders(List (successfulExecutorAttemptDirectory))
892
898
}
893
899
894
- res
900
+ items.toList.asJava
895
901
}
896
902
897
903
private def stitchAndWriteToTiff (tiles : Iterable [(SpatialKey , MultibandTile )], filePath : String ,
0 commit comments