r-spatialecology/landscapemetrics

error with raster-dev

rhijmans opened this issue · 5 comments

When checking landscapemetrics with the dev version of "raster" (https://github.com/rspatial/raster) I now get

  > test_check("landscapemetrics")
  [ FAIL 1 | WARN 15 | SKIP 4 | PASS 1899 ]
  
  ══ Skipped tests (4) ═══════════════════════════════════════════════════════════
  • On CRAN (4): 'test-scale-window.R:8:5', 'test-scale-window.R:26:5',
    'test-scale-window.R:42:5', 'test-scale-window.R:75:5'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Failure ('test-spatialize-lsm.R:40:5'): spatialize_lsm returns CRS ──────────
  raster::projection(result[[1]][[1]]) not equal to raster::projection(podlasie_ccilc).
  1/1 mismatches
  x[1]: "+proj=longlat +datum=WGS84 +no_defs"
  y[1]: "+proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs"
  
  [ FAIL 1 | WARN 15 | SKIP 4 | PASS 1899 ]
  Error: Test failures
  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, but now more so. sp::identicalCRS does not work well with Raster* objects anymore. You may want to "CRS(Raster*)" before comparing, or terra::same.crs(x, y).

I know you are going to remove support for raster anyway (thank you), so perhaps you can for now suppress this test?

Thanks for pointing out the error and already having a solution for it. As you said, we will remove the raster support soon and in fact are done with our transition to terra.

So I think the easiest would be to skip the test on CRAN given we will push the new update supporting terra this summer anyhow. What are you thinking @Nowosad

  • Skip test on CRAN for now: b20c347
  • Use terra::same.crs for next major release: ce920dc,

A quick-and-dirty hotfix is on its way to CRAN just not running the test for now. @rhijmans let me know if that works for you

Hi @mhesselbarth -- looks good (especially the major release solution)

That works for me and thank you for the quick action!