Skip to content

Migrate from raster to terra and fix CRAN archival failure - #75

Merged
temospena merged 4 commits into
masterfrom
60-abandon-raster-and-move-to-terra
Jun 16, 2026
Merged

temospena merged 4 commits into
masterfrom
60-abandon-raster-and-move-to-terra

Conversation

@temospena

Copy link
Copy Markdown
Collaborator

Summary of Changes
This PR addresses the recent CRAN archival of slopes by fixing the donttest issue and simultaneously resolving the long-standing technical debt of migrating away from the deprecated raster package.

This PR supersedes both PR #73 and PR #74, as it includes the CRAN fixes from those PRs alongside a complete migration to terra.

Key Changes:

  • Migrated from raster to terra (Fixes Abandon raster and move to terra #60):
    • raster is no longer under active development and has been removed from Imports. terra is now the sole raster dependency for slopes.
    • Replaced all raster::extract(), raster::crs(), and raster::raster() calls with terra:: equivalents.
    • Added backward compatibility shims: old Raster* objects are still accepted but emit a helpful message converting them to SpatRaster.
    • Deprecated the terra= and output_format= arguments.
  • Fixed CRAN Archival Failure (Fixes Fix CRAN donttest failure causing package archival #72):
    • The elevation_add() example that triggered ceramic/Mapbox downloads and caused the CRAN failure is now wrapped in \dontrun{} instead of \donttest{}.
  • Dataset Updates:
    • Renamed the bundled dataset from dem_lisbon_raster to dem_lisbon(). Since terra::SpatRaster objects contain C++ pointers that invalidate upon .rda serialization, the dataset is now shipped as a .tif in inst/ and accessed via the new dem_lisbon() function.

Verification:

  • R CMD check --as-cran passes with 0 errors, 0 warnings, and 0 notes.
  • All 46 tests pass.

Closes / Supersedes:

@temospena temospena linked an issue Jun 16, 2026 that may be closed by this pull request
@temospena
temospena requested a review from Robinlovelace June 16, 2026 11:24
@temospena

Copy link
Copy Markdown
Collaborator Author

I suppose that we this we can resubmit to CRAN, and release a v1.1?

@Robinlovelace Robinlovelace left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one optional recommendation. Good to go though from my perspective, great work @temospena !

Comment thread R/data.R
#' @export
#' @examples
#' dem_lisbon()
dem_lisbon <- function() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread R/slope_get.R Outdated
#' @param ... Additional arguments passed to ceramic::cc_elevation
#' @param output_format Character string specifying output format ("raster" or "terra")
#' @return Elevation raster data covering the routes
#' @param output_format Deprecated. Ignored; always returns a SpatRaster.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 why not simply remove this though? It's fine to have breaking changes and will mean fewer lines of code if we don't have Deprecated arguments in our packages, so that would be my recommendation here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch! I'll remove that.

@temospena
temospena merged commit 273e64e into master Jun 16, 2026
4 checks passed
@temospena
temospena deleted the 60-abandon-raster-and-move-to-terra branch June 16, 2026 16:35
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

Successfully merging this pull request may close these issues.

Fix CRAN donttest failure causing package archival Abandon raster and move to terra

2 participants