@@ -514,7 +514,8 @@ def add_raster(
514
514
vmax : Optional [float ] = None ,
515
515
nodata : Optional [float ] = None ,
516
516
attribution : Optional [str ] = None ,
517
- layer_name : Optional [str ] = "Local COG" ,
517
+ layer_name : Optional [str ] = "Raster" ,
518
+ array_args : Optional [Dict ] = {},
518
519
** kwargs ,
519
520
):
520
521
"""Add a local raster dataset to the map.
@@ -533,9 +534,16 @@ def add_raster(
533
534
vmax (float, optional): The maximum value to use when colormapping the colormap when plotting a single band. Defaults to None.
534
535
nodata (float, optional): The value from the band to use to interpret as not valid data. Defaults to None.
535
536
attribution (str, optional): Attribution for the source raster. This defaults to a message about it being a local file.. Defaults to None.
536
- layer_name (str, optional): The layer name to use. Defaults to 'Local COG'.
537
+ layer_name (str, optional): The layer name to use. Defaults to 'Raster'.
538
+ array_args (dict, optional): Additional arguments to pass to `array_to_image`. Defaults to {}.
537
539
"""
538
540
541
+ import numpy as np
542
+ import xarray as xr
543
+
544
+ if isinstance (source , np .ndarray ) or isinstance (source , xr .DataArray ):
545
+ source = array_to_image (source , ** array_args )
546
+
539
547
tile_layer , tile_client = get_local_tile_layer (
540
548
source ,
541
549
indexes = indexes ,
0 commit comments