[gdal-dev] Re: Scale dependent VRT for overviews

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Mon May 14 10:14:15 EDT 2012


Hi,

I am not sure if it is already possible to do what I want with .VRT file but I
just do not know how. Therefore I prepared a test set if someone happens to be
interested in having a look.

Zip file is at http://latuviitta.org/documents/scale_dependent_gdal_meta_vrt.zip

The package contains:
- two images with 1 m pixel size (left_100.tif and right_100.tif)
- a .vrt file "100_percent.vrt" combining full resolution images

- two images with 2 m pixel size (left_50.tif and right_50.tif)
- a .vrt file "50_percent.vrt" combining half resolution images

- two images with 4 m pixel size (left_25.tif and right_25.tif)
- a .vrt file "25_percent.vrt" combining quarter resolution images

- overviews.vrt file which is created as
  gdalbuildvrt -resolution highest overviews.vrt *.vrt

I can open overview.vrt with Quantum GIS and it shows the rasters OK. Obviously
is is drawing all the layers from the VRT file on top of each other. The 50
percent layer is last in the overview.vrt file and it is drawn last by QGis and
it is the one Qgis user sees.

What I am dreaming of is having a control for setting reasonable scale ranges
for the layers included in overviews.vrt. I have been thinking that it could be
doen with something like "PixelSizeRange" directive. The following VRT would
lead to use
- 100_percent.vrt if output pixel size is less than 2 m
- 50_percent.vrt between 2 an 4 m output pixels
- 25_percent.vrt if output pixels are 4 m or bigger

<SimpleSource>
  <PixelSizeRange MaxXPixelSize="2" MaxYPixelSize="2" </PixelSizeRange>
      <SourceFilename relativeToVRT="1">100_percent.vrt</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="24000" RasterYSize="12000" DataType="Byte"
BlockXSize="128" BlockYSize="128" />
      <SrcRect xOff="0" yOff="0" xSize="24000" ySize="12000" />
      <DstRect xOff="0" yOff="0" xSize="24000" ySize="12000" />
    </SimpleSource>

    <SimpleSource>
<PixelSizeRange MinXPixelSize="2" MinYPixelSize="2" MaxXPixelSize="4"
MaxXPixelSize="4" </PixelSizeRange>
      <SourceFilename relativeToVRT="1">50_percent.vrt</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="12000" RasterYSize="6000" DataType="Byte"
BlockXSize="128" BlockYSize="128" />
      <SrcRect xOff="0" yOff="0" xSize="12000" ySize="6000" />
      <DstRect xOff="0" yOff="0" xSize="24000" ySize="12000" />
    </SimpleSource>

    <SimpleSource>
<PixelSizeRange MinXPixelSize="4" MinYPixelSize="4" </PixelSizeRange>
      <SourceFilename relativeToVRT="1">25_percent.vrt</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="6000" RasterYSize="3000" DataType="Byte"
BlockXSize="128" BlockYSize="128" />
      <SrcRect xOff="0" yOff="0" xSize="6000" ySize="3000" />
      <DstRect xOff="0" yOff="0" xSize="24000" ySize="12000" />
    </SimpleSource>

The result could be pretty convenient and flexible sometimes. For raster map
datasets each overview could contain maps which are rendered to suit best for
just that scale range. Dataset could contain a couple of lossless TIFF layers
first and one lossy JPEG2000 layer for taking care of all the rest resolution
levels. Resampling methods could be selected in the most flexible way, each
resolution layer could be updated individually and so on.

-Jukka Rahkonen-



More information about the gdal-dev mailing list