Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error with raster-dev #6

Open
rhijmans opened this issue Jul 3, 2023 · 0 comments
Open

error with raster-dev #6

rhijmans opened this issue Jul 3, 2023 · 0 comments

Comments

@rhijmans
Copy link

rhijmans commented Jul 3, 2023

When checking "leaflet.multiopacity" with the development version of "raster" (https://github.com/rspatial/raster) I get:

Package: leaflet.multiopacity
Check: examples
New result: ERROR
  Running examples in ‘leaflet.multiopacity-Ex.R’ failed
  The error most likely occurred in:

  > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
  > ### Name: addOpacityControls
  > ### Title: Add Opacity Controls
  > ### Aliases: addOpacityControls
  >
  > ### ** Examples
  >
  > # Load libraries
  > library(leaflet)
  > library(leaflet.multiopacity)
  > library(raster)
  Loading required package: sp
  The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
  which was just loaded, will retire in October 2023.
  Please refer to R-spatial evolution reports for details, especially
  https://r-spatial.org/r/2023/05/15/evolution4.html.
  It may be desirable to make the sf package available;
  package maintainers should consider adding sf to Suggests:.
  The sp package is now running under evolution status 2
       (status 2 uses the sf package in place of rgdal)
  >
  > # Create raster example
  > r <- raster(xmn = -2.8, xmx = -2.79,
  +             ymn = 54.04, ymx = 54.05,
  +             nrows = 30, ncols = 30)
  Warning in sp::CRS(...) : sf required for evolution_status==2L
  > values(r) <- matrix(1:900, nrow(r), ncol(r), byrow = TRUE)
  > crs(r) <- crs("+init=epsg:4326")
  Warning in sp::CRS(...) : sf required for evolution_status==2L
  >
  > # Provide layerId, group or category to show opacity controls
  > # If not specified, will render controls for all layers
  > # Example using layerId
  > leaflet() %>%
  +   addProviderTiles("Wikimedia", layerId = "Wikimedia") %>%
  +   addRasterImage(r, layerId = "raster") %>%
  +   addAwesomeMarkers(lng = -2.79545, lat = 54.04321,
  +                     layerId = "hospital", label = "Hospital") %>%
  +   addOpacityControls(layerId = c("raster", "hospital"))
  Warning in sp::CRS(...) : sf required for evolution_status==2L
  Warning in sp::CRS(epsg3857) : sf required for evolution_status==2L
  Error: [project] input crs is not valid
  Execution halted

This is due to changes in "raster" related to the changes in the "sp family" packages. I did not look into the details for this particular error, but comparing CRSs is always tricky, but now more so. sp::identicalCRS does not work well with Raster* objects anymore. You may want to "CRS(Raster*)" before comparing or use terra::same.crs(x, y).

Can you please fix this so that things won't break on CRAN?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant