How to turn gpclibPermit() to TRUE

我的未来我决定 提交于 2019-11-26 16:41:43

问题


When I run gpclibPermit(), I've got the answer FALSE. How can I change it to be TRUE?


回答1:


I've struggled with the gpclibPermit issue myself. You don't provide a reproducible example, but I am guessing that you are having a sesion like this:

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()
> gpclibPermitStatus()
[1] FALSE
> gpclibPermit()
[1] FALSE
> gpclibPermitStatus()
[1] FALSE

At this point it helps to look at what gpclibPermit and gpclibPermitStatus actually do:

> gpclibPermit
function ()  
{
if ("gpclib" %in% .packages(all.available = TRUE)) 
    assign("gpclib", TRUE, envir = .MAPTOOLS_CACHE)
if (gpclibPermitStatus()) 
    warning("support for gpclib will be withdrawn from maptools at the next major release")
gpclibPermitStatus()
}
<environment: namespace:maptools>
> gpclibPermitStatus
function () 
    get("gpclib", envir = .MAPTOOLS_CACHE)
<environment: namespace:maptools>

That is, you can't give maptools the permission to use gpclib unless you have the package gpclib installed.

install.packages("gpclib")
library(maptools)
Loading required package: sp
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()

> gpclibPermit()
[1] TRUE
Warning message:
In gpclibPermit() :
support for gpclib will be withdrawn from maptools at the next major release
> gpclibPermitStatus()
[1] TRUE



回答2:


I had this issue myself and found it easiest to install rgeos, and ensure that it was attached prior to attaching maptools

library(ggplot2)
library(rgeos)
library(maptools)


来源:https://stackoverflow.com/questions/21093399/how-to-turn-gpclibpermit-to-true

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