Support for "terra" in mapview
Dear Tim, Given the advantages of the new "terra" package over the "raster" package, would it be possible to include support for "terra" in mapview?
Thanks Gilberto
Definitely on my to-do-list. But I am currently starting to re-vamp internal raster processing to be based on stars and then simply use their coercion methods for other raster formats (raster, terra). This will, however, likely take a while... For the short term I fear you're stuck with coercing the terra object to raster before calling mapview.
Ok, no problem!
I find the terra package very raw at the moment, especially when handling certain type of files such as ncdf, and also some of the functions really need to be polished or are just missing. I wouldn't prioritize until the package terra is out of beta.
Mileages may vary. I find terra to be a stable package for the basic functions and much faster than raster.
I work with large global rasters with 1000+ layers and it has crashed on me several times, it badly integrates with other packages such as rasterVis, sf, etc. For basic stuff is nice, but once you work with large files it still needs work. I don't know why it was released in this state.
I have just realised my workaround for this is likely to be perfectly acceptable for mapview. You just need to convert using raster::raster() then apply mapview()
Closed with https://github.com/r-spatial/mapview/pull/435
The raster package will be deprecated in 2023 according to a message i get when i load it! Has this workaround been implemented in the terra package? I cannot seem to find a solution in terra that works.
In the sits package, we solved the problem of displaying B/W and RGB images by using a combination of leaflet, leafem, and stars. It works nicely for use. Please see the code in https://github.com/e-sensing/sits/blob/master/R/sits_view.R and https://github.com/e-sensing/sits/blob/master/R/api_view.R.
The raster package will be deprecated in 2023
Could you pls copy that message here? I only see a message from a package it loads, sp, which mentions that rgdal, rgeos and maptools will retire. raster no longer depends on any of those, to the best of my knowledge.
You are right about the message ( se below) but my assumption is that if the packages underpinning the package will be retired then the package itself may not work properly or may not be available?
> library(raster)
Loading required package: sp
The legacy packages maptools, rgdal, and rgeos, underpinning this package
will retire shortly. Please refer to R-spatial evolution reports on
https://r-spatial.org/r/2023/05/15/evolution4.html for details.
No, from https://cran.r-project.org/web/packages/raster/index.html you can see that raster does not depend in any way on maptools, rgdal or rgeos.