R 包未检测到 GDAL 的更新版本
R package doesn't detect updated version of GDAL
我正在尝试从 raster
转移到新的 terra
R 包,这需要在我的机器上安装最新版本的 GDAL (MacOS 10.14.6)。
我按照此处的说明更新了 GDAL:http://www.alexchubaty.com/post/2020-01-08-using-latest-gdal-macos-redux/,它似乎有效。当我在终端显示 运行 gdalinfo --version
时:
GDAL 3.1.1, released 2020/06/22
但是当我在 R 中加载 terra
库时,它似乎仍然 link 到旧版本的 GDAL (2.4.2):
> library(terra)
This is terra version 0.7.11 (alpha-release)
NOTE: You are using GDAL version 2.4.2
For full functionality you need at least version 3.0.4
有趣的是,rgdal
包似乎检测到更新版本:
> library(rgdal)
Loading required package: sp
rgdal: version: 1.5-12, (SVN revision 1018)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 3.1.2, released 2020/07/07
Path to GDAL shared files: /usr/local/Cellar/gdal/3.1.2/share/gdal
GDAL binary built with GEOS: TRUE
Loaded PROJ runtime: Rel. 7.1.0, August 1st, 2020, [PJ_VERSION: 710]
Path to PROJ shared files: /Users/jamesmccarthy/Library/Application Support/proj:/usr/local/opt/proj/share/proj:/usr/local/Cellar/proj/7.1.0/share/proj
PROJ CDN enabled:FALSE
Linking to sp version:1.4-2
To mute warnings of possible GDAL/OSR exportToProj4() degradation,
use options("rgdal_show_exportToProj4_warnings"="none") before loading rgdal.
Attaching package: ‘rgdal’
The following object is masked from ‘package:terra’:
project
有谁知道如何获取 terra
到 link 最新版本的 GDAL?我猜旧版本仍然安装在机器上的某个地方。
我猜您是从源代码安装的 rgdal
,但是 terra
的 二进制版本 来自 CRAN。因此,在从命令行执行(您已经执行的操作)之后:
brew install pkg-config
brew install gdal
您应该使用以下 R 命令得到您想要的东西
install.packages("terra", type = "source")
或者,对于切削刃
remotes::install_github("rspatial/terra")
祝你 terra
好运!
我正在尝试从 raster
转移到新的 terra
R 包,这需要在我的机器上安装最新版本的 GDAL (MacOS 10.14.6)。
我按照此处的说明更新了 GDAL:http://www.alexchubaty.com/post/2020-01-08-using-latest-gdal-macos-redux/,它似乎有效。当我在终端显示 运行 gdalinfo --version
时:
GDAL 3.1.1, released 2020/06/22
但是当我在 R 中加载 terra
库时,它似乎仍然 link 到旧版本的 GDAL (2.4.2):
> library(terra)
This is terra version 0.7.11 (alpha-release)
NOTE: You are using GDAL version 2.4.2
For full functionality you need at least version 3.0.4
有趣的是,rgdal
包似乎检测到更新版本:
> library(rgdal)
Loading required package: sp
rgdal: version: 1.5-12, (SVN revision 1018)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 3.1.2, released 2020/07/07
Path to GDAL shared files: /usr/local/Cellar/gdal/3.1.2/share/gdal
GDAL binary built with GEOS: TRUE
Loaded PROJ runtime: Rel. 7.1.0, August 1st, 2020, [PJ_VERSION: 710]
Path to PROJ shared files: /Users/jamesmccarthy/Library/Application Support/proj:/usr/local/opt/proj/share/proj:/usr/local/Cellar/proj/7.1.0/share/proj
PROJ CDN enabled:FALSE
Linking to sp version:1.4-2
To mute warnings of possible GDAL/OSR exportToProj4() degradation,
use options("rgdal_show_exportToProj4_warnings"="none") before loading rgdal.
Attaching package: ‘rgdal’
The following object is masked from ‘package:terra’:
project
有谁知道如何获取 terra
到 link 最新版本的 GDAL?我猜旧版本仍然安装在机器上的某个地方。
我猜您是从源代码安装的 rgdal
,但是 terra
的 二进制版本 来自 CRAN。因此,在从命令行执行(您已经执行的操作)之后:
brew install pkg-config
brew install gdal
您应该使用以下 R 命令得到您想要的东西
install.packages("terra", type = "source")
或者,对于切削刃
remotes::install_github("rspatial/terra")
祝你 terra
好运!