Skip to content
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

gridDist - cannot overwrite existing file error #1522

Closed
ClarePearson opened this issue May 29, 2024 · 1 comment
Closed

gridDist - cannot overwrite existing file error #1522

ClarePearson opened this issue May 29, 2024 · 1 comment

Comments

@ClarePearson
Copy link

Hello,

I've been trying to create a distance surface with gridDist but keep getting the error "cannot overwrite existing file". This only happens when running the function on larger rasters, I think because it can't overwrite the temp file being created in the process?

minimal example:

require(terra)

r <- rast(ext = ext(c(xmin = 0, xmax = 7e+05, ymin = 0, ymax = 1300000)), res = 25, crs = "EPSG:27700")

r[] <- 1:ncell(r)

r_test <- gridDist(r, target=100, maxiter = 100, overwrite=T)

windows 10 64-bit, terra version ‘1.7.78’, R version 4.4.0,
gdal proj geos
"3.8.4" "9.3.1" "3.12.1"

@rhijmans
Copy link
Member

Thank you very much for reporting. I believe this has been fixed now. You can test with a smaller dataset by setting the option "todisk" to TRUE (this simulates using a large dataset).

library(terra)
r <- rast(ext = ext(c(xmin = 0, xmax = 7e+05, ymin = 0, ymax = 1300000)), res = 25000, crs = "EPSG:27700")
r[] <- 1:ncell(r)
terraOptions(todisk=T)
r_test <- gridDist(r, target=100, maxiter = 100, overwrite=T)

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

No branches or pull requests

2 participants