mapview
mapview copied to clipboard
viewRGB() support for stars input
viewRGB() works fine with Raster input, but does not support stars objects as of yet. Would you be willing to implement that?
data(
"KiLi"
, package = "Orcs"
)
## convert to stars
strs = stars::st_as_stars(
KiLi
, crs = 32737
)
mapview::viewRGB(strs, r = 1, b = 3)
currently fails with
Error in mapview::viewRGB(strs, r = 1, b = 3) : 'x' must be a Raster* object.
Converting to Raster solves the issue:
mapview::viewRGB(as(strs, "Raster"), r = 1, b = 3)

Strange enough, plotting KiLi as regular 3-layered RasterStack directly with
mapview::viewRGB(KiLi, r = 1, b = 3)
gives
Error in CRS(projfrom) : no method for coercing this S4 class to a vector
, which I believe is a different matter.
I came here to raise the exact same issue. Given that terra and/or stars seems to be replacing raster, it would be nice to have support for these formats.