[gdal-dev] ERROR when requesting raster data outside coverage of VRT

Casper Børgesen caboe at sdfe.dk
Wed Apr 26 02:16:49 PDT 2017


Hi,

I am trying to read some floating point data from a VRT file. The VRT file references a set of VRT files which again references a set of GeoTIFF files.

Using Python I call dataset.ReadAsArray(x, y, width, height) to request the data. In my case I end up requesting data which is outside the bounds of the VRT file resulting in the following error:

ERROR 5: my.vrt, band 1: Access window out of range in RasterIO().  Requested
(1129975,637475) of size 2550x2550 on raster of 1132500x885000.

If I was working with a normal GeoTIFF file I could calculate if I was outside the bounds and crop my request accordingly. But since I am working with a VRT file I don't know how to determine if the VRT file has coverage or not. I vaguely remember a similar issue with gdal_translate which was fixed to allow requesting data partially and completely outside the bounds of the VRT file and just return zero (?) on the cells outside.

Shouldn't this also occur in my case described above even though I am using python and not gdal_translate to request data?

I am using python 2.7.6 and GDAL 2.1.3 x64 from OSGeo4W.

Regards, Casper

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170426/fac51a99/attachment.html>


More information about the gdal-dev mailing list