Skip to main content

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

Hey, there!

It is quite near to the thing you are inserting into the arguments - you need to put there an Option of a function, try this:

writer.update(layernane, rdd, 0, Some((v1: GeoTiff[Tile], v2: GeoTiff[Tile]) => {
    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)
  }))

Best,

Grigory

On Thu, Nov 22, 2018 at 7:52 PM Langlois, Josée-Anne (NRCan/RNCan) <josee-anne.langlois@xxxxxxxxx> wrote:

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

 

_______________________________________________
geotrellis-user mailing list
geotrellis-user@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/geotrellis-user


--
С уважением,
Помадчин Григорий.
Skype: daunnc
ICQ: 133662

Back to the top