无法正确安装 rgdal,我已经尝试了这里提到的所有建议和所有建议 R 即使在安装包后也找不到包
library(rgdal)
rgdal: version: 1.4-3, (SVN revision 828)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20
Path to GDAL shared files: C:/Users/xxx/Documents/R/win-library/3.4/rgdal/gdal
GDAL binary built with GEOS: TRUE
Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
Path to PROJ.4 shared files: C:/Users/xxx/Documents/R/win-library/3.4/rgdal/proj
Linking to sp version: 1.3-1
Warning message:
package ‘rgdal’ was built under R version 3.4.4
我已将我的 R 升级到 3.6.1
再试一次:
batch_gdal_translate(x, desc, outsuffix = "4.img", of = "HFA", co="TILED=YES")
NULL
Warning messages:
1: In gdal_setInstallation() :
No GDAL installation found. Please install 'gdal' before continuing:
- www.gdal.org (no HDF4 support!)
- www.trac.osgeo.org/osgeo4w/ (with HDF4 support RECOMMENDED)
- www.fwtools.maptools.org (with HDF4 support)
2: In gdal_setInstallation() : If you think GDAL is installed, please run:
gdal_setInstallation(ignore.full_scan=FALSE)
我试图从 Rstudio 和命令行 R 3.6.1 GUI 运行它。
每次我都尝试过这个,我得到了正在安装的库的积极结果。
library(raster)
Loading required package: sp
library(rgdal)
rgdal: version: 1.4-4, (SVN revision 833)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20
Path to GDAL shared files: C:/Users/xxx/Documents/R/R-3.6.1/library/rgdal/gdal
GDAL binary built with GEOS: TRUE
Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
Path to PROJ.4 shared files: C:/Users/xxx/Documents/R/R-3.6.1/library/rgdal/proj
Linking to sp version: 1.3-1
library(gdalUtils)
Registered S3 method overwritten by 'R.oo':
method from
throw.default R.methodsS3
我要读取的文件是 dted 文件?
x <- list.files(path = src, pattern = ".dt", full.names = TRUE)
length(x)
batch_gdal_translate(x, desc, outsuffix = "4.img", of = "HFA", co="TILED=YES")
我也用 GTIFF .tif 格式尝试了上述方法,但我得到了同样的错误。但我不是要读取 .hdf 文件,只是 .dt0、.dt1、.dt2
这将在我安装了 R 的另一台机器上工作,但是,我试图找出我在“这台”机器上的安装有什么问题。