我正在尝试使用 readGDAL{rgdal}读取这个 ASTER/GDEM geotiff 文件。我知道 GDAL 本身可以很好地读取文件,因为gdalinfo /path/file.tif
它给出了以下输出:
Size is 3601, 3601
Coordinate System is:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4326"]]
Origin = (85.999861111111116,23.000138888888888)
Pixel Size = (0.000277777777778,-0.000277777777778)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 85.9998611, 23.0001389) ( 85d59'59.50"E, 23d 0' 0.50"N)
Lower Left ( 85.9998611, 21.9998611) ( 85d59'59.50"E, 21d59'59.50"N)
Upper Right ( 87.0001389, 23.0001389) ( 87d 0' 0.50"E, 23d 0' 0.50"N)
Lower Right ( 87.0001389, 21.9998611) ( 87d 0' 0.50"E, 21d59'59.50"N)
Center ( 86.5000000, 22.5000000) ( 86d30' 0.00"E, 22d30' 0.00"N)
Band 1 Block=3601x1 Type=Byte, ColorInterp=Red
Band 2 Block=3601x1 Type=Byte, ColorInterp=Green
Band 3 Block=3601x1 Type=Byte, ColorInterp=Blue
但是当我尝试使用以下代码将文件导入 R 时:
a = readGDAL(system.file("/path/file.tif", package="rgdal")[1])
我收到此错误消息:
Error in readGDAL(system.file("/path/file.tif", :
empty file name
我已经尝试过使用其他 geotiff 文件,但我收到了相同的错误消息。我究竟做错了什么?有没有更好的方法来导入 GTiff 文件?