[gdal-dev] Warped VRT and overviews

Sean Gillies sean at mapbox.com
Sat Sep 30 10:21:12 PDT 2017


Hi Even,

On Fri, Sep 29, 2017 at 2:38 PM, Even Rouault <even.rouault at spatialys.com>
wrote:

> Hi Sean,
>
>
>
> >
>
> > It's been my understanding that GDAL's RasterIO (most current version)
> uses
>
> > overviews when available, implicitly. Is this also true for VRTs and
> warped
>
> > VRTs or is not true?
>
>
>
> Yes, it is supposed to, and below demonstrates a working case of that
> capability:
>
>
>
> (byte.tif is
>
> https://github.com/OSGeo/gdal/blob/trunk/autotest/gcore/data/byte.tif)
>
>
>
> gdal_translate byte.tif test.tif -outsize 2048 2048
>
>
>
> Create uniformly grey overview:
>
> gdal_translate test.tif test.tif.ovr -outsize 256 256 -scale 0 255 127 127
>
>
>
> gdalwarp test.tif test_warped.vrt -of VRT -t_srs EPSG:3857 -overwrite
>
>
>
> gdal_translate test_warped.vrt small.tif -outsize 256 256 --debug on
>
>
>
> small.tif is grey as expected
>
>
>
> >
>
> > I ask because 1) in reading from a warped VRT (using vsicurl) I'm not
>
> > seeing use of the overviews in the GeoTIFF source that surface in the
> VRT,
>
> > and
>
>
>
> Perhaps you're doing something different from the above ?
>
>
>
>
>
> > 2) in reading the source of gdalwarp_lib.cpp I see that it has its own
>
> > code for navigating overview levels and does not rely on any implicit
>
> > overviews.
>
>
>
> Yes gdalwarp itself can be told which overview level to use from the
> source raster, but the VRT warped code also has logic to use overviews of
> the source raster :
>
>
>
> https://github.com/OSGeo/gdal/blob/trunk/gdal/frmts/vrt/vrtwarped.cpp#L550
>
>
>
> Even
>

Indeed, I had gotten myself into a situation where the test at

https://github.com/OSGeo/gdal/blob/7f622319fee6ff75e6ddab1b622568
4264f34d85/gdal/frmts/vrt/vrtsourcedrasterband.cpp#L169

failed and the overviews were skipped. Thanks for getting me back on the
right track. The VRTWarpedDataset class is very handy. I'm looking forward
to being able to use VSICurlClearCache in production, it'll be handy for
testing my warped VRT code.

Thanks and bon weekend,

-- 
Sean Gillies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170930/8b36b032/attachment.html>


More information about the gdal-dev mailing list