[R-sig-Geo] Raster - rgdal Error: Failure during raster IO

Michael Sumner mdsumner at gmail.com
Mon Jul 6 15:28:58 CEST 2015


Have you tried with the GDAL utilities? It might be be worth reporting on
what gdalinfo returns and what you get with gdal_translate, and please
report on the version/s you use. You did say 'I’ve tried reading direct
with gdal' but seems you mean 'with rgdal', which is close but also
different again since you get things into R. You might also try the
underlying R-GDAL-api with functions like GDAL.open and the "[" methods for
those objects.

It might be that you need a more recent version of GDAL, and you can
control that more easily by using GDAL directly - though it can be hard
still. It's certainly possible to build your own rgdal against a more
recent GDAL too, though it's a bit of a deep hole even in Linux.

There might be vagaries of tiling or compression causing problems so the
output of gdalinfo is relevant. I created a RGB image of the same size and
I can read one band with readGDAL fine (on Windows with the rgdal CRAN
build), though I hit memory limits if I try to read all 3 bands. I can't
reproduce your error with my own testing, but I haven't done a lot of that
either.  If you have more specifics reported by gdalinfo we could do more
targeted testing on different systems.

Cheers, Mike.

On Mon, 6 Jul 2015 at 18:32 Ben Weinstein <benweinstein2010 at gmail.com>
wrote:

> Hi all,
>
> I'm getting a generic, " Error: Failure during raster IO" when trying to
> crop or plot a .tif file using the raster package.
>
> I made a markdown document showing the issue.
>
>
> https://htmlpreview.github.io/?https://github.com/bw4sz/Drone/blob/master/error.html
>
> To summarize:
>
> I received a orthomosiac image from a collaborator that i'm reading into R.
> The file was captured using a unmanned aerial vehicle and stitched in
> Agisoft Photoscan, and the resulting .tif was sent to me.
>
> The file is quite large (~4gb on disk) and at very high resolution.
>
> When i read in using raster, everything seems fine. The extent matches the
> correct location on the earth's surface.
>
> I’ve tried over multiple computers, reading as brick/stack/raster,
> reinstalling rgdal/raster, reinstalling R and playing around with the file
> names.
>
> Given the huge file size, i assume that this is has to do with memory (as
> been suggested elsewhere with this error) - although checking out the task
> manager, i see no memory spike (i have ~60gb memory) and it appears to be a
> formatting error for gdal. I’ve tried reading direct with gdal, and that
> fails, even when reading just a portion.
>
> I worry that the because resolution has been labeled in reference to
> latlong (Seconds?)  and is very small, and is approaching some rounding
> error.
>
> The metadata reads in correctly.
>
>
> > r
>
> class       : RasterLayer
>
> band        : 1  (of  4  bands)
>
> dimensions  : 39891, 35132, 1401450612  (nrow, ncol, ncell)
>
> resolution  : 1.83715e-07, 1.3612e-07  (x, y)
>
> extent      : -122.9106, -122.9042, 42.41708, 42.42251  (xmin, xmax, ymin,
> ymax)
>
> coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
> +towgs84=0,0,0
>
> data source : C:\Users\Ben\Dropbox\Droning\AgisoftFull20150425_Run3.tif
>
> names       : AgisoftFull20150425_Run3
>
> values      : 0, 255  (min, max)
>
>
> I appreciate any thoughts on the next thing to try.
>
> Best,
>
> Ben
>
>
> Ecology and Evolution
>
> Stony Brook University
>
> http://benweinstein.weebly.com/
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list