我正在尝试从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
库时,它似乎仍然链接到旧版本的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
链接到GDAL的最新版本吗?我猜旧版本仍然安装在计算机上的某个地方。
答案 0 :(得分:1)
我猜您从源头安装了rgdal
,但从CRAN安装了terra
的二进制版本。因此,从命令行执行了(您已经做了)之后:
brew install pkg-config
brew install gdal
您应该使用以下R命令获得想要的东西
install.packages("terra", type = "source")
或者,对于最前沿的
remotes::install_github("rspatial/terra")
terra
祝你好运!