Skip to content

error with raster-dev #6

@rhijmans

Description

@rhijmans

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions