ropensci / slopes

Package to calculate slopes of roads, rivers and trajectories
https://docs.ropensci.org/slopes/
GNU General Public License v3.0
70 stars 6 forks source link

Error with terra objects #22

Closed Robinlovelace closed 3 years ago

Robinlovelace commented 3 years ago

Noticed that the README was failing after I installed the latest version of the terra package. I've found the issue, captured in the small reproducible example:

library(slopes)

u = "https://github.com/ITSLeeds/slopes/releases/download/0.0.0/dem_lisbon.tif"
if(!file.exists("dem_lisbon.tif")) download.file(u, "dem_lisbon.tif")
r = lisbon_road_segments
et = terra::rast("dem_lisbon.tif")
slope_raster = slope_raster(r, et)
#> [1] TRUE
#> Error in `[.data.frame`(terra::extract(e, m[, 1:2], method = method), : undefined columns selected

Created on 2021-01-10 by the reprex package (v0.3.0)