Closed geryan closed 2 months ago
Ugh, nope, it's not the version, now I get same issue with 1.6.0 and 1.40. WHAT HAVE I DONE TO MYSELF
Ruhroh. Let me take a look
I think this is something I've done by my foolish moment of zeal in updating packages / rstudio / r and now I have no idea what the breakage is
The first example used terra_rast_example
but that script created terra_vect_example
- which as you pointed out, is also straight from the README, so thanks for identifying that!
But I couldn't replicate the error I'm sorry - here's my reprex.
library(targets)
tar_dir({ # tar_dir() runs code from a temporary directory.
tar_script({
library(geotargets)
lux_area <- function(projection = "EPSG:4326") {
terra::project(
terra::vect(system.file("ex", "lux.shp",
package = "terra"
)),
projection
)
}
list(
tar_terra_vect(
terra_vect_example,
lux_area()
)
)
})
tar_make()
x <- tar_read(terra_vect_example)
x
})
#> ▶ dispatched target terra_vect_example
#> ● completed target terra_vect_example [0.021 seconds]
#> ▶ ended pipeline [0.066 seconds]
#> class : SpatVector
#> geometry : polygons
#> dimensions : 12, 6 (geometries, attributes)
#> extent : 5.74414, 6.528252, 49.44781, 50.18162 (xmin, xmax, ymin, ymax)
#> source : terra_vect_example
#> coord. ref. : lon/lat WGS 84 (EPSG:4326)
#> names : ID_1 NAME_1 ID_2 NAME_2 AREA POP
#> type : <num> <chr> <num> <chr> <num> <int>
#> values : 1 Diekirch 1 Clervaux 312 18081
#> 1 Diekirch 2 Diekirch 218 32543
#> 1 Diekirch 3 Redange 259 18664
tar_dir({ # tar_dir() runs code from a temporary directory.
tar_script({
library(targets)
library(geotargets)
list(
tar_terra_rast(
terra_rast_example,
system.file("ex/elev.tif", package = "terra") |> terra::rast()
)
)
})
tar_make()
x <- tar_read(terra_rast_example)
x
})
#> ▶ dispatched target terra_rast_example
#> ● completed target terra_rast_example [0.007 seconds]
#> ▶ ended pipeline [0.064 seconds]
#> class : SpatRaster
#> dimensions : 90, 95, 1 (nrow, ncol, nlyr)
#> resolution : 0.008333333, 0.008333333 (x, y)
#> extent : 5.741667, 6.533333, 49.44167, 50.19167 (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326)
#> source : terra_rast_example
#> name : elevation
#> min value : 141
#> max value : 547
Created on 2024-04-23 with reprex v2.1.0
FWIW: reinstalling terra
solved this issue 🤷🏼♂️
I update my packages like a good boy and now it no work no good 😭
Created on 2024-04-23 with reprex v2.1.0