New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhead in vrt()
#1258
Comments
I've also noticed that reading in a ".vrt" that's already been created and that references many rasters takes a while - at least it takes longer than I expect, although I'm not familiar with what's going on under the hood, so I'm not sure what a reasonable expectation is. library(terra)
#> terra 1.7.39
r <- rast(system.file("ex/elev.tif", package = "terra"))
paths <- makeTiles(r, 3, tempfile(fileext = ".tif"))
length(paths)
#> [1] 960
system.time(r_vrt <- vrt(paths))
#> user system elapsed
#> 3.44 2.66 6.36
system.time(rast(sources(r_vrt)))
#> user system elapsed
#> 2.11 1.65 4.06 Created on 2023-08-24 with reprex v2.0.2 |
I think the difference is because
Which is about the same duration as
There could be an option to only create the .vrt file and not return a SpatRaster. |
You can now request that the filename is returned instead of a SpatRaster:
|
Thanks! Now I get: system.time({ terra::vrt(ff, filename = vrt) })
#> user system elapsed
#> 8.17 7.70 15.87
system.time({ terra::vrt(ff, filename = vrt, return_filename = TRUE) })
#> user system elapsed
#> 3.30 2.45 5.75 |
Maybe there is room for optimizing the
vrt()
function?The text was updated successfully, but these errors were encountered: