[gdal-dev] Does the VRT SimpleSource element's OVERVIEW_LEVEL open option apply to the Overview element?

Sean Gillies sean at mapbox.com
Mon Oct 8 14:03:42 PDT 2018


Dear group,

Does the OVERVIEW_LEVEL open option described in
https://www.gdal.org/gdal_vrttut.html#gdal_vrttut_format apply to VRT
Overview elements? It occurs to me that if it did, we could add external
overviews to a dataset using a single VRT file instead of the nested VRTs
shown in https://lists.osgeo.org/pipermail/gdal-dev/2012-July/033299.html.

For example, if I have a GeoTIFF with no overviews named cog_novr.tif and
another GeoTIFF at half resolution *with* overviews, I could virtually add
all those overview levels to the full resolution dataset like this (I
think?)

<VRTDataset rasterXSize="5080" rasterYSize="5194">
  <SRS>...</SRS>
  <GeoTransform>...</GeoTransform>
  <VRTRasterBand dataType="UInt16" band="1">
    <ColorInterp>Gray</ColorInterp>
    <SimpleSource>
      <SourceFilename relativeToVRT="1">cog_novr.tif</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="7621" RasterYSize="7791"
DataType="UInt16" BlockXSize="512" BlockYSize="512" />
      <SrcRect xOff="0" yOff="0" xSize="7621" ySize="7791" />
      <DstRect xOff="0" yOff="0" xSize="5080.22220278191"
ySize="5193.55553653945" />
    </SimpleSource>

    <Overview>
      <!-- First overview is provided by the main image in the TIFF that
             has all the overviews -->
      <SourceFilename relativeToVRT="1">cog_ovrs.tif</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="3810" RasterYSize="3895"
DataType="UInt16" BlockXSize="512" BlockYSize="512" />
      <SrcRect xOff="0" yOff="0" xSize="3810" ySize="3895" />
      <DstRect xOff="0" yOff="0" xSize="5080.22220278191"
ySize="5193.55553653945" />
    </Overview>

    <Overview>
      <!-- Second overview is provided by the first (index 0) overview of
the TIFF that
             has all the overviews -->
      <SourceFilename relativeToVRT="1">cog_ovrs.tif</SourceFilename>
      <OpenOptions>
        <OOI key="OVERVIEW_LEVEL">0</OOI>
      </OpenOptions>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="1905" RasterYSize="1948"
DataType="UInt16" BlockXSize="512" BlockYSize="512" />
      <SrcRect xOff="0" yOff="0" xSize="1905" ySize="1948" />
      <DstRect xOff="0" yOff="0" xSize="5080.22220278191"
ySize="5193.55553653945" />
    </Overview>

  </VRTRasterBand>
</VRTDataset>

With GDAL 2.2.4, gdalinfo tells me that this VRT has two overviews, but the
overview levels reported look suspicious:

Band 1 Block=128x128 Type=UInt16, ColorInterp=Gray
  Overviews: 3810x3895, 3810x3895

I expected to see a 1905x1948 overview above.

Should I expect the open option to work? If not, could it be made to work
or does that go against the grain of VRT features?

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


More information about the gdal-dev mailing list