使用rgdal导入geotiff文件时出错

使用rgdal导入geotiff文件时出错,r,gis,R,Gis,我正在尝试使用readGDAL{rgdal}读入。我知道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"]],

我正在尝试使用readGDAL{rgdal}读入。我知道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文件?

错误消息很清楚,您的文件名不正确

您不需要
system.file
,即“查找R系统文件的名称”(请参阅
?system.file

尝试使用文件的路径:

 a = readGDAL("/path/file.tif")
您可以使用检查它是否存在

file.exists("/path/file.tif")

我懂了。我只是在看rgdal文档。很高兴知道。谢谢,萨姆纳先生。