[osgeo4w-dev] error rgdal library if used from within Grass plugin (Windows)

Roger Bivand Roger.Bivand at nhh.no
Mon Feb 9 13:32:32 EST 2009

On Mon, 9 Feb 2009, Agustin Lobo wrote:

> Hi!
> The following error only occurs if the R (2.7.2) session is started
> from a GRASS shell opened through the QGIS GRASS plugin in windows.
> The error does not occur If R is started form its own icon
> or by double click in the .RData  object,  but then the spgrass6
> package would not find the GRASS environment.
> It also works in linux.
> The involved  commands  are:
> 1. Start  QGIS
> 2. Star GRASS plugin and open mapset
> 3.  Open Grass Shell
> 4.  Run R and execute require(spgrass6)
>>>>> Loading required package: spgrass6
>>>>> Loading required package: sp
>>>>> Loading required package: rgdal
>>>>> Error in fun(...) :
>>>>>         GDAL Error 1: Can't load requested DLL:
>>>>> C:\OSGeo4W\bin\gdalplugins\gdal_ECW_JP2ECW.dll
>>>>> 126: Não foi possível encontrar o módulo especificado.


I've already replied to this question twice already, on R-sig-geo and 
statgrass. You are not saying which rgdal Windows binary you are using - 
without knowing that, any resolution is hopeless. If you are using my 
trial binary on:


as mentioned in my message to R-sig-geo:


then either version drift, or QGIS not passing on PATH values are 
possible. I don't think that this is likely, as it was built against R 

There is an underlying question about how to build and distribute the R 
contributed packages sp, rgdal and spgrass6 in the OSGeo4W framework. 
Bundling R in OSGeo4R doesn't seem to be a good idea, because users will 
prefer, I think, to use their own R installation. So probably OSGeo4W 
should ship with Windows package binaries for current R (changes every six 
months), including a custom built rgdal. I've built this with the 
downloadable MS VC++ compiler and build train, and would have to rebuild 
for each rgdal release, and in any case when R upgrades.


>>>>> Error : .onLoad failed in 'loadNamespace' for 'rgdal'
>>>>> Erro: package 'rgdal' could not be loaded
> Any help appreciated.
> Agus

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no

More information about the osgeo4w-dev mailing list