0

I am running a project that requires reading .tif files as rasters. However, when I try to load the files in now, I get th error:

Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer", : Cannot create a RasterLayer object from this file. In addition: Warning message: 'file location/name.tif' not recognized as a supported file format. (GDAL error 4)

I'm using the function raster("file location/name.tif") and it has been working until recently.

I am currently working with the raster package along with sp and rgdal. I've updated each of the packages and still get this error. I've also tried installing and using the terra package but get the same error with that as well.

I'm not sure what to do at this point since I'm pretty sure it isn't an issue with the code I'm running because I haven't changed anything since the last time it worked.

Robert Hijmans
  • 40,301
  • 4
  • 55
  • 63
Hlr
  • 1
  • That suggests the file is corrupted. Can you share it? – Robert Hijmans Feb 15 '23 at 15:51
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Please list all the packages you have loaded and in what order you loaded them. – MrFlick Feb 15 '23 at 15:52

0 Answers0