@@ -271,6 +271,7 @@ addRasterImage <- function(
271271 project = project ,
272272 method = method ,
273273 maxBytes = maxBytes ,
274+ options = options ,
274275 data = data
275276 )
276277 } else if (inherits(x , " RasterLayer" )) {
@@ -285,6 +286,7 @@ addRasterImage <- function(
285286 project = project ,
286287 method = method ,
287288 maxBytes = maxBytes ,
289+ options = options ,
288290 data = data
289291 )
290292 } else {
@@ -392,6 +394,7 @@ addRasterImage_RasterLayer <- function(
392394 project = TRUE ,
393395 method = c(" auto" , " bilinear" , " ngb" ),
394396 maxBytes = 4 * 1024 * 1024 ,
397+ options = gridOptions(),
395398 data = getMapData(map )
396399) {
397400
@@ -450,7 +453,7 @@ addRasterImage_RasterLayer <- function(
450453 list (raster :: ymin(bounds ), raster :: xmax(bounds ))
451454 )
452455
453- invokeMethod(map , data , " addRasterImage" , uri , latlng , opacity , attribution , layerId , group , options ) %> %
456+ invokeMethod(map , data , " addRasterImage" , uri , latlng , layerId , group , options ) %> %
454457 expandLimits(
455458 c(raster :: ymin(bounds ), raster :: ymax(bounds )),
456459 c(raster :: xmin(bounds ), raster :: xmax(bounds ))
@@ -468,6 +471,7 @@ addRasterImage_SpatRaster <- function(
468471 project = TRUE ,
469472 method = c(" auto" , " bilinear" , " ngb" ),
470473 maxBytes = 4 * 1024 * 1024 ,
474+ options = gridOptions(),
471475 data = getMapData(map )
472476) {
473477 if (! is_installed(" terra" , " 1.6-3" )) { # for terra::has.RGB()
@@ -477,6 +481,9 @@ addRasterImage_SpatRaster <- function(
477481 )
478482 }
479483
484+ options $ opacity <- opacity
485+ options $ attribution <- attribution
486+
480487 if (terra :: has.RGB(x )) {
481488 # RGB(A) channels to color table
482489 x <- terra :: colorize(x , " col" )
@@ -554,7 +561,7 @@ addRasterImage_SpatRaster <- function(
554561 list (terra :: ymin(bounds ), terra :: xmax(bounds ))
555562 )
556563
557- invokeMethod(map , data , " addRasterImage" , uri , latlng , opacity , attribution , layerId , group ) %> %
564+ invokeMethod(map , data , " addRasterImage" , uri , latlng , layerId , group , options ) %> %
558565 expandLimits(
559566 c(terra :: ymin(bounds ), terra :: ymax(bounds )),
560567 c(terra :: xmin(bounds ), terra :: xmax(bounds ))
0 commit comments