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

Casper Børgesen caboe at sdfe.dk
Wed Apr 26 03:43:45 PDT 2017


Hi Even,



Thanks for your reply. I think I get it now.



Well, a VRT dataset is a GDAL dataset, so there's no difference from API usage when requesting a VRT or a GeoTIFF

You can use ds.RasterXSize / ds.RasterYSize to know the VRT dimensions and check if x + width > ds.RasterXSize or y + height > ds.RasterYSize



Okay, so as long as I stay within the VRT bbox I can request data. If I request data inside the VRT bbox even though it doesn't have GeoTIFF coverage there, I will still get a result (consisting of zeros)?



This is indeed a conveniency of gdal_translate itself. Using ReadAsArray() you must stick to the dataset dimensions.



And I find it very convenient :)



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


More information about the gdal-dev mailing list