[gdal-dev] GTI datasets: overview usage question

Even Rouault even.rouault at spatialys.com
Mon Jul 22 06:20:54 PDT 2024


Salut Thomas,

There were actually 2 issues:

- contrary to what the documentation stated, OVERVIEW_0_xxxx metadata 
items were simply ignored, hence you only got overviews starting at the 
1/4 reduction

- and the documentation also lied when implying that it would 
automatically add overviews of overview datasets

Both issues are now fixed per https://github.com/OSGeo/gdal/pull/10465.

You can workaround both issues by:

- starting your OVERVIEW_{idx} at 1  (this will be compatible of GDAL 
3.9.2, that will be tolerant to {idx} starting at 0 or 1)

- and you can explicitly add overviews of your hat dataset by specifying 
OVERVIEW_{idx}_OPEN_OPTIONS=OVERVIEW_LEVEL=NONE to gets its full 
resolution, OVERVIEW_{idx+1}_OPEN_OPTIONS=OVERVIEW_LEVEL=0 to get its 
first overview, etc. (this will also be compatible of GDAL 3.9.2, since 
specifying the OVERVIEW_LEVEL open option prevents other overviews to be 
added)

So something like:

   OVERVIEW_1_FACTOR=2
   OVERVIEW_2_FACTOR=4
   OVERVIEW_3_FACTOR=8
   OVERVIEW_4_FACTOR=16
   OVERVIEW_5_FACTOR=32
   OVERVIEW_6_FACTOR=64
   OVERVIEW_7_FACTOR=128
   OVERVIEW_8_DATASET=/*snip*/lr.tif
   OVERVIEW_8_OPEN_OPTIONS=OVERVIEW_LEVEL=NONE
   OVERVIEW_9_DATASET=/*snip*/lr.tif
   OVERVIEW_9_OPEN_OPTIONS=OVERVIEW_LEVEL=0
   OVERVIEW_10_DATASET=/*snip*/lr.tif
   OVERVIEW_10_OPEN_OPTIONS=OVERVIEW_LEVEL=1

Even


Hi list,
> I'm experimenting with the GTI driver and hitting an issue when trying 
> to add overviews.
> I'm compiling a large number of adjacent non-overlapping tiles, each 
> of which has is own bundled overviews:
>
> gdalinfo /*snip*/tile-1377-471.tif
>
> Size is 32768, 32768
> Origin = (3.057607090103000,48.420794507110998)
> Pixel Size = (0.000004056990000,-0.000002694048000)
> Band 1 Block=512x512 Type=Byte, ColorInterp=Red
>   NoData Value=0
>   Overviews: 16384x16384, 8192x8192, 4096x4096, 2048x2048, 1024x1024, 
> 512x512, 256x256
> Band 2 Block=512x512 Type=Byte, ColorInterp=Green
>   NoData Value=0
>   Overviews: 16384x16384, 8192x8192, 4096x4096, 2048x2048, 1024x1024, 
> 512x512, 256x256
> Band 3 Block=512x512 Type=Byte, ColorInterp=Blue
>   NoData Value=0
>   Overviews: 16384x16384, 8192x8192, 4096x4096, 2048x2048, 1024x1024, 
> 512x512, 256x256
>
> I also have a very low resolution "hat" file that covers the whole 
> work area:
>
> gdalinfo /*snip*/lr.tif
> Size is 2100, 1792
> Origin = (1.413084112150000,49.303580186365998)
> Pixel Size = (0.001045206663490,-0.000689676288000)
> Band 1 Block=256x256 Type=Byte, ColorInterp=Red
>   NoData Value=0
>   Overviews: 1050x896, 525x448, 263x224, 132x112
> Band 2 Block=256x256 Type=Byte, ColorInterp=Green
>   NoData Value=0
>   Overviews: 1050x896, 525x448, 263x224, 132x112
> Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
>   NoData Value=0
>   Overviews: 1050x896, 525x448, 263x224, 132x112
>
> I would like to create a GTI dataset referencing all these tiles, and 
> the "hat" dataset, and have created it like so:
>
> ogrinfo -so -al mosaic.gti.fgb:
>
> Layer name: tileindex
> Metadata:
>   BAND_COUNT=3
>   DATA_TYPE=Byte
>   NODATA=0
>   OVERVIEW_0_FACTOR=2
>   OVERVIEW_1_FACTOR=4
>   OVERVIEW_2_FACTOR=8
>   OVERVIEW_3_FACTOR=16
>   OVERVIEW_4_FACTOR=32
>   OVERVIEW_5_FACTOR=64
>   OVERVIEW_6_FACTOR=128
>   OVERVIEW_7_DATASET=/*snip*/lr.tif
>   RESAMPLING=bilinear
>   RESX=0.00000269495773407954
>   RESY=0.00000269495773407954
>
> However when I inspect the gti dataset, the overview count is not what 
> I expect:
>
> gdalinfo mosaic.gti.fgb:
>
> Size is 814460, 458598
> Origin = (1.413084000000000,49.303579999999997)
> Pixel Size = (0.000002694957734,-0.000002694957734)
> Band 1 Block=256x256 Type=Byte, ColorInterp=Undefined
>   NoData Value=0
>   Overviews: 203615x114650, 101808x57325, 50904x28663, 25452x14332, 
> 12726x7166, 6363x3583, 2100x1792
>
> Note the overview list, which I would have expected to be:
>
> 407230x229299, 203615x114650, 101808x57325, 50904x28663, 25452x14332, 
> 12726x7166, 6363x3583, 2100x1792, 1050x896, 525x448, 263x224, 132x112
>
> but is not, i.e. it is missing the first overview level of the 
> individual tiles, and the overviews of the hat dataset.
> Is this a configuration issue on my end ?
>
> Thanks,
> Thomas
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list