[gdal-dev] Scale dependent VRT for overviews

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Mon Jul 2 06:28:54 PDT 2012


Even Rouault <even.rouault <at> mines-paris.org> writes:

> 
> Jukka,
> 
> I think you could achieve what you want by adding a <Overview> element (see 
> http://www.gdal.org/gdal_vrttut.html ) inside the <VRTRasterBand> element. The 
> dataset pointed by the <SourceFilename> in <Overview> can be a .vrt.
> 
> So, schematically, you would have something like 100_percent.vrt :
> 
> <VRTDataset>
>    <VRTRasterBand>
>        <Overview>
>            <SourceFilename relativeToVRT="1">50_percent.vrt</SourceFilename>
>            <SourceBand>1</SourceBand>
>        </Overview>
>    </VRTRasterBand>
> </VRTDataset>
> 
> and in 50_percent.vrt :
> 
> <VRTDataset>
>    <VRTRasterBand>
>        <Overview>
>            <SourceFilename relativeToVRT="1">25_percent.vrt</SourceFilename>
>            <SourceBand>1</SourceBand>
>        </Overview>
>    </VRTRasterBand>
> </VRTDataset>

I finally tried how it goes with VRT overviews.  The result is rather well
usable with QGis. The VRT file containing an overview chain opens a bit slow but
once it is open it works totally transparently for the user. I had luck in my
trial because all my images do not have same extents which relealed one trouble.
Finland gets squeezed when zoomed far out because two images with smallest
scales are wider than the others.  For preventing wrong scaling I guess I should
clip all overview images to suit the extents of the primary VRT. Anyway, I
consider that this kind of system could be useful sometimes.

Test set is downloadable from
http://latuviitta.org/documents/GDAL_Scale_dependent_VRT_test.zip

Archive contains 5 original tiffs, each with a different pixel size and
rendering styles, and corresponding .VRT files.  Unzip and open the "t0320.vrt"
file with QGis and that's all.  QGis and user believes it is just one map even
all five originals are used one by one depending on the scale.

The native SRID is EPSG:3067.

-Jukka Rahkonen-







More information about the gdal-dev mailing list