Error: isTRUE(gpclibPermitStatus()) is not TRUE

主宰稳场 提交于 2019-12-03 10:39:12

问题


This question may be a duplicate of an earlier unanswered one. I still have the problem.

I am trying to use a zipcode shapefile and coming up with the following error:

tract <- readOGR(dsn = ".", layer = "cb_2013_us_zcta510_500k")
tract<-fortify(tract, region="GEOID10")
Error: isTRUE(gpclibPermitStatus()) is not TRUE

I have tried installing gpclib to fix this but then I get the following error:

install.packages("gpclib")

Installing package into ‘C:/Users/Nick/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘gpclib’
  These will not be installed

Help?


回答1:


You can look at Hadley's master file for ggplot2/R/fortify-spatial.r. Based on this outside link, my understanding is that lines 31–34 (in it's current form) used to read something like

# Union together all polygons that make up a region
try_require(c("gpclib", "maptools"))
unioned <- unionSpatialPolygons(cp, invert(polys))

So back then one way to attack the problem was to turn on the license

library(rgdal)
library(maptools)
if (!require(gpclib)) install.packages("gpclib", type="source")
gpclibPermit()

As @rcs, @Edzer Pebesma, and this answer mention, rgeos should resolve the issue for more recent installations.




回答2:


I ran into the same problem but the solution was slightly different than those listed above.

As mentioned by others, the issue is the dependency on gpclib, which is required by maptools.

However, after loading maptools, it provided the following message ...

> library('maptools')

Checking rgeos availability: FALSE
Note: when rgeos is not available, polygon geometry     computations in maptools depend on gpclib,
which has a restricted licence. It is disabled by default;
to enable gpclib, type gpclibPermit()

So rgeos can be used instead of gpclib. To resolve, I did the following ...

install.packages('rgeos', type='source')
install.packages('rgdal', type='source')

The reinstallation of rgdal removes the dependency on gpclib and points to rgeos.

Hope this is helpful.




回答3:


I learned this answer elsewhere: I had to type

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

and it worked just fine.



来源:https://stackoverflow.com/questions/30790036/error-istruegpclibpermitstatus-is-not-true

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!