Closed ebolch closed 2 years ago
Thank you. The GDAL configuration options were not exposed by terra. On linux you could set them with rgdal, as GDAL is a shared library, but on windows each R package has its own copy. I now get:
library(terra)
#terra 1.5.26
## options not set
getGDALconfig(c("GDAL_HTTP_UNSAFESSL", "GDAL_HTTP_COOKIEFILE"))
# GDAL_HTTP_UNSAFESSL GDAL_HTTP_COOKIEFILE
# "" ""
## set options as "option=value"
setGDALconfig(c("GDAL_HTTP_UNSAFESSL=YES",
"GDAL_HTTP_COOKIEFILE=.rcookies",
"GDAL_HTTP_COOKIEJAR=.rcookies",
"GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR",
"CPL_VSIL_CURL_ALLOWED_EXTENSIONS=TIF"))
## options have been set
getGDALconfig(c("GDAL_HTTP_UNSAFESSL", "GDAL_HTTP_COOKIEFILE", "GDAL_HTTP_COOKIEJAR"))
# GDAL_HTTP_UNSAFESSL GDAL_HTTP_COOKIEFILE GDAL_HTTP_COOKIEJAR
# "YES" ".rcookies" ".rcookies"
## reset to default
setGDALconfig(c("GDAL_HTTP_UNSAFESSL", "GDAL_HTTP_COOKIEFILE", "GDAL_HTTP_COOKIEJAR"), c("", "", ""))
getGDALconfig(c("GDAL_HTTP_UNSAFESSL", "GDAL_HTTP_COOKIEFILE", "GDAL_HTTP_COOKIEJAR"))
# GDAL_HTTP_UNSAFESSL GDAL_HTTP_COOKIEFILE GDAL_HTTP_COOKIEJAR
# "" "" ""
## set options as "options, values"
setGDALconfig(c("GDAL_HTTP_UNSAFESSL", "GDAL_HTTP_COOKIEFILE"), c("YES", ".rcookies"))
getGDALconfig(c("GDAL_HTTP_UNSAFESSL", "GDAL_HTTP_COOKIEFILE", "GDAL_HTTP_COOKIEJAR"))
# GDAL_HTTP_UNSAFESSL GDAL_HTTP_COOKIEFILE GDAL_HTTP_COOKIEJAR
# "YES" ".rcookies" ""
I'm trying to use
rast
to access NASA Earthdata cloud optimized geotiffs. A NASA Earthdata account and a netrc file with login and password are required(Earthdata netrc setup script).I've been trying the following, but seem to be getting an authentication error:
I am able to do this successfully with the raster and rgdal packages:
Am I just passing on the gdal config options incorrectly? Any help would be appreciated.