Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPKG and gdaladdo : top-level grid has been changed (1 X 1 instead of 2 X 1) #3853

Closed
FilipGh opened this issue May 19, 2021 · 1 comment
Closed
Milestone

Comments

@FilipGh
Copy link

FilipGh commented May 19, 2021

Expected behavior and actual behavior.

The original GPKG image has been created with InspireCRS84Quad tiling scheme :
The top-level grid is 2 X 1
This image is a bit specific : it lays over the antimeridian.

I have detected an error when creating overviews : The top-level grid is modified to1 X 1

Steps to reproduce the problem.

1 ) With GDAL 3.0.2 :
Creating overview with "implicit" values (or manual values up to 32) ends up with an error :
(see ogrgeopackagedatasource.cpp)

PROMPT > gdaladdo lena_wgs84_withOverview.gpkg
ERROR 6: Too big overview factor : 32. Would result in a 144x7 overview
Overview building failed.
PROMPT >

Creating overview with manual values up to 16 is OK

PROMPT > gdaladdo lena_wgs84_withOverview.gpkg 2 4 8 16
PROMPT >

The top-level grid is OK :

PROMPT > sqlite3 -header -column lena_wgs84_noOverview.gpkg "SELECT rowid,* FROM gpkg_tile_matrix WHERE zoom_level = 0 ;"
rowid       table_name  zoom_level  matrix_width  matrix_height  tile_width  tile_height  pixel_x_size  pixel_y_size
----------  ----------  ----------  ------------  -------------  ----------  -----------  ------------  ------------
1           tiles       0           2             1              256         256          0.703125      0.703125
PROMP >

2 ) With GDAL 3.2.0 and 3.2.2 :
Creating overview with "implicit" values (or manual values up to 32) DOES NOT end up with an error.

PROMPT > cp lena_wgs84_noOverview.gpkg lena_wgs84_withOverview.gpkg
PROMPT > gdaladdo lena_wgs84_withOverview.gpkg
PROMPT >

However, the original GPKG grid is broken : the 1st zoom level grid is 1 X 1 (no longer 2 X 1).

PROMPT > sqlite3 -header -column lena_wgs84_withOverview.gpkg "SELECT rowid,* FROM gpkg_tile_matrix WHERE zoom_level = 0 ;"
rowid       table_name  zoom_level  matrix_width  matrix_height  tile_width  tile_height  pixel_x_size  pixel_y_size
----------  ----------  ----------  ------------  -------------  ----------  -----------  ------------  ------------
6           tiles       0           1             1              256         256          2.8125        2.8125

lena_wgs84_noOverview.zip
lena_wgs84_withOverview.zip

Operating system

Windows 10

GDAL version and provenance

Versions 3.0.2, 3.2.0 and 3.2.2
These versions are compiled with Visual C++ 2015 64 bits

@rouault
Copy link
Member

rouault commented Jan 8, 2024

Fixed in master 3.9dev per d178b03e3db

@rouault rouault closed this as completed Jan 8, 2024
@rouault rouault added this to the 3.9.0 milestone Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants