Skip to content

rgdal 0.7-1 release

2 messages · Roger Bivand, Renaud Lancelot

#
This release may cause trouble.

It has been found that an application (QGIS) plugin (SDA4P) loading R and 
rgdal through rpy2, and with QGIS linking to GDAL itself directly, has 
been occasionally seeing muddles with regard to error handling on Linux.

The CRAN Windows and CRAN extras OSX binary packages are built static, so 
don't see the problem (they have private copies of GDAL), but in order to 
try to resolve this, and following exchanges with Even Rouault, a GDAL 
developer, major changes in error handling in rgdal have been made.

Before, the R error handler was set to catch GDAL errors on the R thread 
(GDAL's error handler is said to be threaded, so rgdal pushed the R 
handler on load and popped it on unload). If the plugin loaded R on the 
same thread as QGIS, the R error handler might be seen by QGIS, instead of 
the QGIS error handler.

Now, the error handler is pushed/popped around every call to a GDAL 
function, on occasion pushed before a loop and popped after the loop.

I have contacted all maintainers of packages on CRAN depending on or 
suggesting rgdal, so that they could check whether their packages are 
affected. William Kyngesburye has been kind enough to clear some other 
issues for his R 2.13 Framework build, but reports no problems so far.

If you see issues, in particular R error exiting because the wrong error 
handler is being applied (only Linux, OSX with rgdal intalled from source 
or Frameworks, or Windows with rgdal installed from source), please 
document fully, preferably reproducibly, and report, and, until fixed, 
revert to the 0.6-* series.

Windows and OSX binaries will not be built for GDAL 1.8.0, but we'll aim 
to build with GDAL 1.8.1 sometime after its (impending) release.

All feedback welcome, including scrutiny of the changes made in the C/C++ 
source code on R-Forge.

Roger
#
Dear all,

I meet a pb when using setValues:

 > library(raster)
 > setwd("d:/analyses/abder")
 > r <- raster("rh.tif")
 > vals <- getValues(r)
 > summary(vals)
    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's
       0     244     440    1646     828   65540  166222
 > vals[!is.na(vals) & ((vals > 10000) | (vals == 0))] <- NA
 > summary(vals)
     Min.  1st Qu.   Median     Mean  3rd Qu.     Max.     NA's
      1.0    241.0    434.0    683.7    798.0   6805.0 173141.0
 > r2 <- setValues(r, vals)
 > plot(r2)
Error in .local(.Object, ...) : empty file name

Any idea of what's going on and how to solve it?

####

Some additional info:

 > class(r)
[1] "RasterLayer"
attr(,"package")
[1] "raster"

 > summary(r)
Cells:  604902

Min.        0
1st Qu.   181
Median    538
Mean     3330
3rd Qu.  1303
Max.    65540
summary based on a sample of 1e+05 cells, which is 16.5316034663466 % of 
all cells

 > slot(slot(r, "file"), "name")
[1] "d:/analyses/abder/rh.tif"

 > slot(slot(r2, "file"), "name")
[1] ""

 > sessionInfo()
R version 2.13.0 Patched (2011-04-28 r55678)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] rgdal_0.6-33   raster_1.8-38  sp_0.9-84      fortunes_1.4-1

All the best,

Renaud