[gdal-dev] The relationship between overview levels and zoom levels?

Even Rouault even.rouault at spatialys.com
Sun Oct 8 04:21:36 PDT 2023


James,

It all depends on how software will deal with overviews. Some might 
explicitly have logic where it inspects which overviews are present and 
decide which one to use. If we are talking about a client like QGIS that 
uses the RasterIO() method on the full resolution band with a window of 
interest (nXOff, nYOff, nXSize, nYSize) and a target buffer size 
(nBufXSize, nBufYSize),  GDAL computes a target downscaling factor for 
that which is the min(nXSize/nBufXSize, nYSize/nBufYSize).  It then 
walks through overviews and will select the frist one whose downscaling 
factor is greater than target_dowscanling_factor / 1.2

If you have overviews at [2,4,8,16]

target_downscaling_factor        selected_overview
-------------------------        --------------------------
]0, 2. /1.2[                     full resolution band
[2. / 1.2, 4. / 1.2[             2x downsampled
[4. / 1.2, 8. / 1.2[             4x downsampled
[8. / 1.2, 16. / 1.2[            8x downsampled
[16. / 1.2, inf[                 16x downsampled

If you just have overview [16]

target_downscaling_factor        selected_overview
-------------------------        --------------------------
]0, 16. /1.2[                    full resolution band
[16. / 1.2, inf[                 16x downsampled

I've submitted in https://github.com/OSGeo/gdal/pull/8526 a doc 
improvement capturing above explanations

Even


Le 08/10/2023 à 00:01, James Sammone via gdal-dev a écrit :
> I'm not sure if this is the best channel to ask this question as it 
> might be beyond the scope, but I've asked it in a few others and have 
> had no responses aside from others also being curious.
>
> I am trying to understand the relationship between overviews and zoom 
> levels so I know how to make more efficient Cloud Optimized GeoTIFFs. 
> Using gdaladdo or gdal.BuildOverviews(), I can create overviews at 
> [2,4,8,16] or at just [16]. From my understanding, this means the size 
> is being divided by those values to provide downsample arrays of the 
> original source. In the first example [2,4,8,16], I've created 4 
> separate overview arrays into the GeoTIFF that are 2x, 4x, 8x, and 16x 
> downsampled. And in the second example using only [16], I've built one 
> overview array into the GeoTIFF that is 16x downsampled.
>
> How can I understand how these overviews are applied when it comes to 
> zoom levels? Does the 16x downsample appear sooner in the second 
> example when zooming out than for the first example due to being first 
> in order? Or do the 16x downsamples appear at the same zoom level for 
> both cases but the second example has additional 2x, 4x, and 8x 
> downsamples that also appear before getting there?
>

> Thanks for any insight into this anyone can provide. Despite using 
> overviews all the time, I've struggled with this for a while and had 
> largely consigned to not understanding it.
>
> Best,
>
> James
>
>
> _______________________________________________
> 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