Skip to content

rgdal Windows change Path to GDAL shared files / not all the Drivers

6 messages · gilles2604, Roger Bivand

#
Hello

I already used rgdal successfully on Mac and on Linux/Ubuntu...

Now I try to make it work on Windows 7 (64 bit).

I have installed GDAL 1.9.1 on my system, but when I do : library(rgdal), I
get this:

/Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.9.0, released 2011/12/29
Path to GDAL shared files: C:/Program Files/R/R-2.15.0/library/rgdal/gdal
Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009, [PJ_VERSION: 470]
Path to PROJ.4 shared files: C:/Program Files/R/R-2.15.0/library/rgdal/proj/

I know that for Mac and Linux, rgdal uses the drivers of the gdal-version
installed on the system...

On Windows it seems to be different, I already change my GDAL_DATA and
GDAL_DATA variables, it didn't helped...

What I need arer the Postgisraster and the PostgreSQL driver...

Anybody has an idea how I could change this?

Thanks a lot



--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/rgdal-Windows-change-Path-to-GDAL-shared-files-not-all-the-Drivers-tp7580079.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
#
On Fri, 1 Jun 2012, gilles2604 wrote:

            
No, this always depends on which rgdal package (binary from where, or 
source) is installed. On Linux, the package must be installed from source, 
so the external dependencies have to be met on the system. On OSX, if 
rgdal is installed from source against for example Kyngchaos frameworks, 
or as a binary package from Kyngchaos, you would be correct. But if it is 
installed as a binary from CRAN Extras, GDAL is linked static. The same 
applies to the CRAN Windows rgdal binary - GDAL is linked static.
To use a local GDAL on Windows, you would need to install from source, 
possibly following one of the routes described in:

file.show(system.file("README.windows", package="rgdal"))

but these notes are very context-specific, and in some cases dated.

Hope this clarifies,

Roger

  
    
#
Tank you, I know understand the problem even if I don't understand why the
static gdal 1.9 doesn't support Postgisraster and Postgres driver (GDAL
1.9.0 normally does).

I tried to install the package from source, but it doesn't work...:

/> install.packages(type="source",c("C:/rgdal_0.7-11.tar.gz"))
Installing package(s) into ?C:/Program Files/R/R-2.15.0/library?
(as ?lib? is unspecified)
inferring 'repos = NULL' from the file name
* installing *source* package 'rgdal' ...
** package 'rgdal' correctement d?compress? et sommes MD5 v?rifi?es
ERROR: configuration failed for package 'rgdal'
* removing 'C:/Program Files/R/R-2.15.0/library/rgdal'
Warning in install.packages :
  l'ex?cution de la commande 'C:/PROGRA~1/R/R-215~1.0/bin/x64/R CMD INSTALL
-l "C:/Program Files/R/R-2.15.0/library"   "C:/rgdal_0.7-11.tar.gz"' renvoie
un statut 1
Warning in install.packages :
  installation of package ?C:/rgdal_0.7-11.tar.gz? had non-zero exit status/

Does anybody had the same problem while installing a package from source?

Thank you

--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/rgdal-Windows-change-Path-to-GDAL-shared-files-not-all-the-Drivers-tp7580079p7580084.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
#
On Fri, 1 Jun 2012, gilles2604 wrote:

            
What GDAL supports is dependent on its external links to other software. 
GDAL can be built with a small set of external dependencies, or a larger 
set. The drivers used for the CRAN Extras OSX rgdal binary, and the CRAN 
Windows rgdal binary are a small subset of all possible drivers, and do 
not include those you are interested in. So GDAL 1.9 may be build with or 
without drivers, there is nothing like "normal support".
This is only going to work if you have taken many steps requiring care and 
insight first, and then only as R CMD INSTALL rgdal, after having 
downloaded the source package and edited files within it as shown in the 
README I refered to. If you do not understand the README, and do not have 
local help to show you how for example to use OSGeo4W (I'm not sure that 
OSGeo4W provides GDAL with PostGIS) and Microsoft compilers and linkers, 
in addition to RTools, you should either give up, or ask whether any other 
list member has built a GDAL/rgdal combination against the same 
PostGIS/PostgreSQL versions that you are using.

Roger

  
    
1 day later
#
Ok, I really try to understand the READ ME, but its quiet difficult to me
because i'm not used to windows...

What i fond was this:


/Run in OSGeo4W console, after setting:

set OSGEO4W_BUILD=yes
set GDAL_HOME=%OSGEO4W_ROOT%

cd rgdal/src

cl /MT /Ox /EHsc /D "WIN32" /c /I "C:/Program Files/R/R-2.8.1/include" /I
C:/OSGeo4W/include /I "C:\Program Files\Microsoft Visual Studio
9.0\VC\include" /D OSGEO4W *.cpp

link /dll /out:rgdal.dll /def:rgdal.def *.obj "C:\Program
Files\R\R-2.8.1\bin\Rdll.lib" /libpath:"C:\Program Files\Microsoft Visual
Studio 9.0\VC\lib" /libpath:"C:\Program Files\Microsoft
SDKs\Windows\v6.0A\Lib" /libpath:"C:\OSGeo4W\lib" gdal_i.lib proj_i.lib

cd ../..

Set Makefile.win as below to all:!!

R CMD INSTALL --build rgdal/

So I have a few questions:

1. OSGeo4W console is this the OSGeo4W shell (simple shell with OSGeo4W as
administrator?)
2. Do I have to run all these commands in this shell?
3. when I do cl... i get the following message: cl is not recognized as a
command...

I'm really desperate, it is the last part of my work...

Maybe you can help me?

Thanks a lot in advance

Gilles 

--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/rgdal-Windows-change-Path-to-GDAL-shared-files-not-all-the-Drivers-tp7580079p7580098.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
#
On Sat, 2 Jun 2012, gilles2604 wrote:

            
I don't think that the list can help - you need local help, really. The 
notes were made for a specific version of OSGeo4W and have not been kept 
updated, so you would need to adapt to your platform. If you don't know 
what cl is, this suggests that you should stay on the platforms for which 
you have compilers (cl is a compiler).

Roger