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

Using /vis3/ for reading geotiff with terra::rast() now appends current drive to start of string in v1.7.65 #1382

Closed
mikoontz-vp opened this issue Dec 20, 2023 · 4 comments

Comments

@mikoontz-vp
Copy link

I was able to use the /vsis3/ approach to read geotiffs from an S3 bucket using {terra} v1.7.55 but this no longer appears to work on Windows for v1.7.65. It does appear to work on macOS. I'm using the latest version of R (4.3.2) and RStudio (RStudio 2023.12.0+369 "Ocean Storm" Release (33206f75bd14d07d84753f965eaa24756eda97b7, 2023-12-14) for windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2023.12.0+369 Chrome/116.0.5845.190 Electron/26.2.4 Safari/537.36)

Testing this requires AWS credentials to be set, as far as I know, so this example won't be reproducible but here's the output when it doesn't work (in v1.7.65):

> sev = terra::rast('/vsis3/vp-sci-grp/fire-severity/processed/landscapes/western-us/postfire_rdnbr.tif')
Error: [rast] file does not exist: C:/vsis3/vp-sci-grp/fire-severity/processed/landscapes/western-us/postfire_rdnbr.tif
In addition: Warning message:
C:/vsis3/vp-sci-grp/fire-severity/processed/landscapes/western-us/postfire_rdnbr.tif: No such file or directory (GDAL error 4) 

When it does work (in previous version of {terra}), there is no "C:" appended ahead of the "/vsis3/" piece.

Any idea what might be going on?

rhijmans added a commit that referenced this issue Dec 21, 2023
@rhijmans
Copy link
Member

This may work:

f1 <- 's3://vp-sci-grp/fire-severity/processed/landscapes/western-us/postfire_rdnbr.tif'
r1 <- terra::rast(f1)

And with the change I just made, this may work again as well:

f2 <- '/vsis3/vp-sci-grp/fire-severity/processed/landscapes/western-us/postfire_rdnbr.tif'
r2 <- terra::rast(f2)

Please let me know.

@mikoontz-vp
Copy link
Author

Hi @rhijmans -- thanks so much for the quick reply! The first approach (using the s3:// link directly) does indeed work on both macOS and Windows 11 with {terra} v1.7.65. Unfortunately, I can't test the second option because I'm not able to install a source package on my Windows machine. But it seems like I can move my workflows to just using the S3 link directly and that will be a compatible solution across systems, though it will break backward compatibility. Thanks again for the fix!

@rhijmans
Copy link
Member

Can't you install the dev version on windows with the line below?

install.packages('terra', repos='https://rspatial.r-universe.dev')

@mikoontz-vp
Copy link
Author

mikoontz-vp commented Dec 21, 2023

!!! I had no idea I could do this! Thanks so much for providing binaries of the dev version! It does indeed install correctly and the second approach does indeed work using {terra} v1.7.67!

I think we can safely close the issue.

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