我在R中遇到导致程序崩溃的问题。我终于能够将问题缩小到以下几个方面。
我发现以下工作:
library(rgeos)
x = readWKT("POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))")
gIsValid(x)
[1] TRUE
但是,以下结果导致崩溃:
library(rgdal)
x = rgeos::readWKT("POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))")
rgeos::gIsValid(x)
在我正在处理的R套餐中,rgdal在" Depends"和rgeos" Imports"下指定。在描述文件中。所以我的代码表现得更像第二个(崩溃)场景。
以下是一些可能有用的信息:
> library(rgeos)
rgeos version: 0.3-23, (SVN revision 546)
GEOS runtime version: 3.6.1-CAPI-1.10.1 r0
Linking to sp version: 1.2-4
Polygon checking: TRUE
> library(rgdal)
Loading required package: sp
rgdal: version: 1.2-7, (SVN revision 660)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.11.5, released 2016/07/01
Path to GDAL shared files: /usr/local/Cellar/gdal/1.11.5_2/share/gdal
Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
Path to PROJ.4 shared files: (autodetected)
Linking to sp version: 1.2-4
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.5
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rgdal_1.2-7 sp_1.2-4 rgeos_0.3-23
loaded via a namespace (and not attached):
[1] compiler_3.4.0 grid_3.4.0 lattice_0.20-35
有关如何避免这种情况的任何想法?这是地理中的错误吗? GDAL?
答案 0 :(得分:0)
最后,重新启动计算机,重新安装rgeos
和rgdal
软件包导致此代码不再崩溃R.