On Wed, 26 Apr 2017, Casper BÞrgesen wrote:
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.
I am not sure whether you noticed that 1129975 + 2550 = 1132525 > 1132500 and thus the requested window is partially outside the VRT's bounds.
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.
I think cropping the request as you would for a normal GeoTIFF should be sufficient. -- Andrew C Aitchison
_______________________________________________ gdal-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/gdal-dev
