I am wanting to use the addRasterImage()
function to a leaflet object in R.
However it only seems to work up-to a zoom level of 18. Please see the example below.
library(raster)
library(leaflet)
library(magrittr)
r <- raster(xmn=-2.8, xmx=-2.79, ymn=54.04, ymx=54.05, nrows=30, ncols=30)
values(r) <- matrix(1:900, nrow(r), ncol(r), byrow = TRUE)
crs(r) <- CRS("+init=epsg:4326")
leaflet() %>% addTiles() %>%
setView(lat=54.045,lng=-2.795,zoom=19) %>%
addRasterImage(r, colors = "Spectral", opacity = 0.8)
I know that the addTiles()
function naturally only shows tiles up to a zoom of 18, but I was assuming that the raster image should still show at the higher zoom level. Furthermore, there are other tile providers (e.g. HERE) that do have zoom levels that go higher than 18, but the issue with the lack of the Raster image on the leaflet object still persists.
Any help would be greatly appreciated.