ropensci/slopes

slope_raster() error with terra rast object

lauren-obrien opened this issue ยท 8 comments

Hi,
this package is so useful! Many thanks.

Unfortunately, there seems to be a new error in slope_raster() when using a terra::rast() object as DEM, see below (example code is from terra::extract() help page, with a couple of mods):

library(sf)
library(terra)    # 1.6-47
library(slopes)

r <-rast(ncols=5, nrows=5, xmin=0, xmax=5, ymin=0, ymax=5)
values(r) <- 1:25
xy <- rbind(c(0.5,0.5), c(2.5,2.5))
p <- vect(xy, crs="+proj=longlat +datum=WGS84", typ = 'lines')
p <- st_as_sf(p)

slope_raster(p, r)
# Error in .local(x, y, ...) : unused argument (method = "bilinear")

slope_raster(p, raster::raster(r))
# runs ok, with appropriate warnings about large distances

This actually looks like a regression in terra, see Issue 46 and commit rspatial/terra@81bfb0a

Thanks for the bug report and very useful reproducible example. Motivation to finally get this on CRAN #45! I guess this issue arose after the latest version of terra on 2nd December, right? https://cran.r-project.org/package=terra

I assume so - sorry, only used this package for the first time today and have been using terra only intermittently of late

Fixed upstream now: rspatial/terra#956

@Robinlovelace I think the pkgdown building is failing due to this same problem. The vignette benchmark.Rmd can't be knit. Should there be a Remotes field in DESCRIPTION until terra is re-released?

@Robinlovelace I think the pkgdown building is failing due to this same problem. The vignette benchmark.Rmd can't be knit. Should there be a Remotes field in DESCRIPTION until terra is re-released?

Probably. Will check with the author of terra on likely ETA for release (talking of which #45 still needs to be on CRAN, any help with that from rOpenSci v. welcome).

@rspatial when is the next version of terra likely to be released?

Many thanks.

And @rhijmans, hopefully you get this notification. Thanks!

I can send it to CRAN sometime this week.

I can send it to CRAN sometime this week.

Fantastic, many thanks Robert.