2

I have problems installing rgdal in windows 8.1, i installed OSGeo4W (is it mandatory btw?), understood that I have to install proj4, but do not really understand what to install on page, I read some documentation, but I feel really ignorant and can't get it to work properly.

I want to access rgdal through R-studio through rgdal, but how can i tell r-studio where to look for gdal and proj4? I am really confused, clearly need some documentation but do not understand where to look for it, because all I read did not seem useful.

rgdal is installed according to R but when I use spTransform it says

Error in spTransform(locations, CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")) : 
  load package rgdal for spTransform methods 

moreover in the system requirements GDAL and proj4 are needed I know that because I already installed all this in Ubuntu, with a lot of effort.

EDIT: I re-started R, now doing library(rgdal) I get this:

Carico il pacchetto richiesto: sp
rgdal: version: 0.8-16, (SVN revision 498)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.11.0, released 2014/04/16
Path to GDAL shared files: C:/R/i686-pc-linux-gnu-library/3.0/rgdal/gdal
GDAL does not use iconv for recoding strings.
Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
Path to PROJ.4 shared files: C:/R/i686-pc-linux-gnu-library/3.0/rgdal/proj
Warning message:
package ‘rgdal’ was built under R version 3.0.3 

is it all ok?

EDIT 2: I updated R, just to see if that could have been the reason. Absolutely no changes in the error message.

Any help is appreciated :)

Irene
  • 744
  • 1
  • 12
  • 36
  • Did you try just running `install.packages("rgdal")` in R-studio? Did that not work/produce an error? – MrFlick Jun 29 '14 at 15:13
  • somehow I cut my questions, please see my edit. – Irene Jun 29 '14 at 15:17
  • you only need gdal and proj4 if you are building from source. Are you? Did you load rgdal before trying `spTransform`? – rawr Jun 29 '14 at 15:29
  • I did. the package is installed, when I do library(rgdal) I have no warnings nor issues, but when I use spTransform I get the error you see above. Therefore I thought something was missing. – Irene Jun 29 '14 at 15:34
  • It is not an error, it says "warning". – mdsumner Jun 29 '14 at 17:48
  • No it is an error. Please re-read carefully. The warning about the update has been fixed, since, as I said, I updated R. – Irene Jun 29 '14 at 19:59
  • 1
    That error message ("load package rgdal for spTransform methods") can be confusing as it's sometimes returned inappropriately, e.g. `library(rgdal); spTransform(1, CRS('+proj=longlat'))`. – jbaums Oct 19 '14 at 07:28
  • Thank you, feeling less stupid now. – Irene Oct 19 '14 at 07:30

1 Answers1

1

The problem solved itself after updating R and turning the pc on and off twice. no idea why but it works.

Irene
  • 744
  • 1
  • 12
  • 36