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

vect does not report when a file is non-existent #784

Closed
johnbaums opened this issue Aug 31, 2022 · 1 comment
Closed

vect does not report when a file is non-existent #784

johnbaums opened this issue Aug 31, 2022 · 1 comment

Comments

@johnbaums
Copy link
Contributor

The error thrown by vect when a character string points to a non-existent file is a bit misleading. It should probably alert the user that the file does not exist, as we see with rast:

terra::vect('this-file-does-not-exist')
# Error: [vect] Cannot open this file as a SpatVector
terra::rast('this-file-does-not-exist')
# Error: [rast] file does not exist: this-file-does-not-exist
# In addition: Warning message:
# this-file-does-not-exist: No such file or directory (GDAL error 4)
> sessioninfo::session_info('terra')
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.2.1 (2022-06-23)
 os       macOS Big Sur 11.6.2
 system   x86_64, darwin17.0
 ui       RStudio
 language (EN)
 collate  en_AU.UTF-8
 ctype    en_AU.UTF-8
 tz       Australia/Melbourne
 date     2022-08-31
 rstudio  2022.07.1+554 Spotted Wakerobin (desktop)
 pandoc   2.18 @ /Applications/RStudio.app/Contents/MacOS/quarto/bin/tools/ (via rmarkdown)

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package * version date (UTC) lib source
 Rcpp      1.0.9   2022-07-08 [1] CRAN (R 4.2.0)
 terra     1.6-7   2022-08-07 [1] CRAN (R 4.2.1)

 [1] /Library/Frameworks/R.framework/Versions/4.2/Resources/library
@rhijmans
Copy link
Member

Thanks, I now get:

terra::vect('this-file-does-not-exist')
#Error: [vect] file does not exist: this-file-does-not-exist

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