[R-sig-Geo] Reporting an issue with rgdal in macOS BigSur

GilbertoCamara g||berto@c@m@r@@|npe @end|ng |rom gm@||@com
Thu Nov 26 15:11:08 CET 2020


Dear R-SIG-GEO and Roger

I am developing an R package (https://github.com/e-sensing/sits <https://github.com/e-sensing/sits>) to analyse satellite image time series (SITS) which is heavily dependent on “rgdal”. 

I would like to report an issue with rgdal in the new macOS BigSur. While I agree with Roger that it is not wise to install a new OS until it is stable, I hope the information below will be useful. 

For starters, let me praise Roger, Edzer and all those involved in “rgdal”. I did some debugging on the source code and was humbled by the effort involved in making the code an operational software many of us rely on. Chapeau bas!

That said, please allow me to report on three issues: 

1. Installation 

I have installed GDAL-3.2.0 using Homebrew on BigSur; it works fine. When installing the binary version of rgdal-1.5-18 (SVN revision 1082) from CRAN, recently released by Simon Urbanek, “rgdal" reports that is is using GDAL-3.1.1, which is not installed. The actual message is:
"Loaded GDAL runtime: GDAL 3.1.1, released 2020/06/22”.  

When installing from source, rgdal recognises GDAL-3.2.0, if the Homebrew libraries are on the path. The message changes to:
"Loaded GDAL runtime: GDAL 3.2.0, released 2020/10/26."

It is odd that the binary version would report using a runtime that is not there.

2. Errors in /vsis3 file access 

In earlier versions of macOS, rgdal had no problems with accessing files in AWS with commands such as:

> s3_file <- "/vsis3/sentinel-s2-l2a/tiles/20/L/KP/2018/8/17/0/R20m/B02.jp2”
> rgdal::GDALinfo(s3_file)

In BigSur, it produces an error. Debugging the rgdal code, I found the error to arise from line 723 of the “gdal-bindings.cpp” file. This is one of the places where rgdal calls the GDAL function “GDALOpenEx”, as follows:

  GDALDataset *pDataset = (GDALDataset *) GDALOpenEx(fn, RWFlag,
    papszAllowedDrivers, papszOpenOptions, NULL);

The function call returns a NULL pointer. Since calling gdalinfo externally or using gdalUtils::gdalinfo works, it seems there is a problem with the return parameters which are provided to rgdal by GDAL. 

To reproduce the issue, one needs AWS credentials. If Roger and/or Edzer wish to have a go at this issue, I can provide a temporary credential for doing so. 

3. Errors in TIFF Decoding 

Running devtools::check() produces a strange error on TIFF decoding on a very small file. The error is odd:

"TIFFReadDirectory: Warning, Unknown field with tag 42112 (0xa480) encountered."

The call stack is as follows:

   1: .Call("RGDAL_OpenDataset", .normalize_if_path(filename, mustWork = NA),     TRUE, silent, allowedDrivers, options, PACKAGE = "rgdal")
   2: .local(.Object, ...)
   3: initialize(value, ...)
   4: initialize(value, ...)
   5: new("GDALReadOnlyDataset", filename, silent = silent, allowedDrivers = allowedDrivers,     options = options)
   6: GDAL.open(fname, silent = silent, allowedDrivers = allowedDrivers,     options = options)
   7: rgdal::GDALinfo(file, silent = FALSE)

The error appears to be in the same place as the one reported above. However, it is hard to reproduce, because when running on the console, rgdal works.

> ndvi_file <- c(system.file("extdata/raster/mod13q1/sinop-ndvi-2014.tif", package = "sits”))
> rgdal::GDALinfo(ndvi_file, silent = FALSE)

However, given that the place on the “rgdal” code where the error occurs is the same, it might be worthwhile to look into the RGDAL-GDAL interface in more detail. 

I know it’s my responsibility to have moved to macOS BigSur too soon. Thus, I do not expect that you address the issue. That said, any help would be much appreciated.

Best regards
Gilberto
===========================
Prof Dr Gilberto Camara
Secretariat Director
GEO - Group on Earth Observations
7 bis, Avenue de La Paix
CH-1211 Geneva - Switzerland
Tel: +41227308480
Web: www.earthobservations.org <http://www.earthobservations.org/>




	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list