What's wrong is that readGDAL tries to allocate all the memory
required and build an object to essentially replace the file, and your
machine cannot provide sufficient resources for that. GDAL.open
provides an open connnection to the file that can be queried in
different ways to read parts of the file as necessary.
You can provide low level arguments to readGDAL to subset/subsample:
"offset", "region.dim", and "output.dim". See ?readGDAL.
But, there are facilities in the raster package to open the file with
GDAL.open and read on demand. Try this:
If your .tif has more than one band, you'll have to use
raster::brick() or raster::stack(), which will read only the first
band by default.
> Dear expeRts,
> I want to read a a.tif file into R.
> When i try this:
> readGDAL("a.tif"), i get the following error:
> a.tif has GDAL driver GTiff
> and has 7200 rows and 7200 columns
> error: can't allocate 395.5 mb vector
> but i can GDAL.open("a.tif") it.
> SO what's wrong with readGDAL?
> PO SU
> mail: [hidden email] > Majored in Statistics from SJTU
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Software and Database Engineer
Australian Antarctic Division
e-mail: [hidden email]