Hi Even,
This is great news ! I will check it out as soon as I can.
Thanks
Philippe
On Mon, Jan 8, 2024 at 1:07 PM Even Rouault
wrote:
> Hi Philippe,
>
> I no longer reproduce the below issues nor
> https://github.com/OSGeo/gdal/issues/3853 with gdaladdo without explicit
> level with GDAL master 3.9dev. This is due to improvement
> https://github.com/OSGeo/gdal/commit/d178b03e3db that reuse existing
> overview levels when they are declared by the dataset. Which is the case
> for a GeoPackage created with a tiling_scheme and with unpopulated levels.
>
> The only case now where the tiling scheme might no longer be respected is
> if the user specifies an overview level beyond the base one, or some
> "weird" factor like 3. But as it is the user that requests that, I don't
> think we should do anything for that case.
>
> Even
> Le 08/01/2024 à 11:57, Philippe Ghesquiere via gdal-dev a écrit :
>
> Dear all,
> A while ago, I opened a ticket which is still opened (
> https://github.com/OSGeo/gdal/issues/3853). I recently bumped into this
> bug with some new data, and I think I tracked the origin.
>
>
> *1) Generate a test image :*
> gdal_create -of GTIFF -co COMPRESS=LZW -a_srs epsg:4326 -a_ullr -180 90
> 180 -90 -burn 128 -outsize 2048 1024 worldwide.tif
>
> *2) Convert to GPKG :*
> gdal_translate -of GPKG -co TILING_SCHEME=InspireCRS84Quad worldwide.tif
> worldwide_no_pyramid.gpkg
>
> The GPKG tile matrix is as expected :
> sqlite3 -header -column worldwide_no_pyramid.gpkg "SELECT rowid,* FROM
> gpkg_tile_matrix ;"
> rowid table_namezoom_level matrix_width matrix_height
> tile_width tile_height pixel_x_size pixel_y_size
> - -- -
> -- ---
> 1 worldwide_no_pyramid 0 2 1 256
> 256 0.703125 0.703125
> 2 worldwide_no_pyramid 1 4 2 256
> 256 0.3515625 0.3515625
> 3 worldwide_no_pyramid 2 8 4 256
> 256 0.175781250.17578125
>
> *3) Compute a default pyramid:*
> cp worldwide_no_pyramid.gpkg worldwide_default_pyramid.gpkg
> gdaladdo worldwide_default_pyramid.gpkg
>
> The GPKG tile matrix is no longer the expected one (InspireCRS84Quad
> InspireCRS84Quad) :
> sqlite3 -header -column worldwide_default_pyramid.gpkg "SELECT rowid,*
> FROM gpkg_tile_matrix ;"
> rowid table_namezoom_level matrix_width matrix_height
> tile_width tile_height pixel_x_size pixel_y_size
> - -- -
> -- ---
> 1 worldwide_no_pyramid 1 2 1 256
> 256 0.703125 0.703125
> 2 worldwide_no_pyramid 2 4 2 256
> 256 0.3515625 0.3515625
> 3 worldwide_no_pyramid 3 8 4 256
> 256 0.175781250.17578125
> 4 worldwide_no_pyramid 0 1 1 256
> 256 1.40625 1.40625
>
> *4) Compute a manual pyramid:*
> cp worldwide_no_pyramid.gpkg worldwide_manual_pyramid.gpkg
> gdaladdo worldwide_manual_pyramid.gpkg 2 4
>
> The GPKG tile matrix is still as expected (InspireCRS84Quad
> InspireCRS84Quad) :
> sqlite3 -header -column worldwide_manual_pyramid.gpkg "SELECT rowid,*
> FROM gpkg_tile_matrix ;"
> rowid table_namezoom_level matrix_width matrix_height
> tile_width tile_height pixel_x_size pixel_y_size
> - -- -
> -- ---
> 1 worldwide_no_pyramid 0 2 1 256
> 256 0.703125 0.703125
> 2 worldwide_no_pyramid 1 4 2 256
> 256 0.3515625 0.3515625
> 3 worldwide_no_pyramid 2 8 4 256
> 256 0.175781250.17578125
>
> *5) Compute a "Weird" pyramid:*
> In this test, I generate too many levels in the pyramid on purpose :
> cp worldwide_no_pyramid.gpkg worldwide_manual_weird_pyramid.gpkg
> gdaladdo worldwide_manual_weird_pyramid.gpkg 2 4 8
>
> The GPKG tile matrix is exactly the same as in
> worldwide_default_pyramid.gpkg :
> sqlite3 -header -column worldwide_manual_weird_pyramid.gpkg "SELECT
> rowid,* FROM gpkg_tile_matrix ;"
> rowid table_namezoom_level matrix_width matrix_height
> tile_width tile_height pixel_x_size pixel_y_size
> - -- -
> -- ---
> 1 worldwide_no_pyramid 1 2 1 256
> 256 0.703125 0.703125
> 2