Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[geotrellis-user] S3COGLayerWriter - update

Hello all!

 

I’m trying to use the new S3COGLayerWriter to write DEM in an S3 catalog. I managed to use the write to properly add dem data in my COG S3 catalog. However, I’m not able to use the update on the writer. Can someone share an example of a scala script used to update data in a S3 COG catalog?

 

Here is the script I’m trying to implement, but I keep having an error :

 

found   : (geotrellis.raster.io.geotiff.SinglebandGeoTiff, geotrellis.raster.io.geotiff.SinglebandGeoTiff) => geotrellis.raster.io.geotiff.SinglebandGeoTiff

[error]  required: Option[(geotrellis.raster.io.geotiff.GeoTiff[?], geotrellis.raster.io.geotiff.GeoTiff[?]) => geotrellis.raster.io.geotiff.GeoTiff[?]]

 

I tried to use GeoTiff type for v1 and v2, but there is no combineDouble method for this type.

 

val store: S3AttributeStore = S3AttributeStore(bucket, catalog)

val writer = S3COGLayerWriter(store)

 

writer.update(layername, rdd, z, (v1:SinglebandGeoTiff, v2:SinglebandGeoTiff) => {
 
val extent = v1.raster.extent
 
  
val tile = v1.raster.tile.combineDouble(v2.raster.tile){ (z1, z2) => {
             
if(isData(z1) && isData(z2)) (z1 + z2) / 2
             
else if (isData(z1)) z1
             
else if (isData(z2)) z2
             
else{
                Double.NaN
// TODO: investigate why returning NODATA is not producing the expected output
             
}
            }
          }
  GeoTiff(tile,extent,WebMercator)
})

 

Thanks!

 

 

Josée-Anne Langlois

 


Back to the top