5

I am trying to work with spatial data that I downloaded here in order to make a map in ggplot2.

library(rgdal)
library(ggplot2)
library(rgeos)
df <- readOGR(mydirectory, layer = 'gem_2013_v1')
df.fort <- fortify(df, region = "AANT_INW")

I keep on getting this error when using the function fortify:

Error: isTRUE(gpclibPermitStatus()) is not TRUE

Has anyone an idea about what's going wrong here? Most appreciated!

EDIT:

As mentioned in the comments a possible duplicate of this question can be found here. It is stated that the solution of the problem can be found in installing package gpclib. I am not sure if that's the case, this package has been removed from CRAN.

Community
  • 1
  • 1
rdatasculptor
  • 8,112
  • 14
  • 56
  • 81
  • 1
    possible duplicate of [How to turn gpclibPermit() to TRUE](http://stackoverflow.com/questions/21093399/how-to-turn-gpclibpermit-to-true) – hrbrmstr Nov 29 '14 at 15:42
  • @hrbrmstr I am not sure if that's the case. Installing and running package gpclib would be the answer to my question, but gpclib is not on CRAN anymore so I noticed. I will add this to my question. – rdatasculptor Nov 29 '14 at 15:58
  • 1
    You can install `rgeos` library and recompile `rgdal` and `ggplot`, and I think it works! as said by @hrbrmstr it's a comon issue :-) – delaye Nov 29 '14 at 21:15
  • I have installed rgeos. I guess I have to find out how now :-). But thanks for the comments anyway! – rdatasculptor Nov 29 '14 at 21:21
  • 1
    gpclib is on CRAN: http://cran.r-project.org/web/packages/gpclib/index.html – IRTFM Nov 29 '14 at 22:53
  • Hi- did you ever solve this? I am experiencing a similar issue – garson Jun 11 '15 at 19:53

2 Answers2

3

I had this issue after upgrading R. I reinstalled rgdal and all was good.

Erik Westlund
  • 556
  • 6
  • 14
3

I had the same problem, I had to install gpclib. I'm not sure if when you made the update it was removed from CRAN, but it's there now. It must be installed from source so you'll have to use the following code:

install.packages("gpclib", type = "source")

Note that to install with this code you'll need to have the appropriate version of Rtools installed.

cmishra
  • 86
  • 1
  • 4