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

MBTiles: gdalinfo may report wrong zoom levels #8565

Closed
jratike80 opened this issue Oct 16, 2023 · 2 comments
Closed

MBTiles: gdalinfo may report wrong zoom levels #8565

jratike80 opened this issue Oct 16, 2023 · 2 comments
Assignees

Comments

@jratike80
Copy link
Collaborator

See the detailed description in https://gis.stackexchange.com/a/468484/30184.

Is short, if three overviewa are added to MBTiles raster file, for example Z17, with
gdaladdo output.mbtiles 2 4 8
then gdalinfo shows some non-existing zoom levels

  maxzoom=17
  minzoom=11

The correct zoom levels 14-17 can be searched from the "tiles" table of the MBTiles database

ogrinfo SQLite:output.mbtiles -sql "SELECT min(zoom_level) as min, max(zoom_level) as max from tiles" output.mbtiles
OGRFeature(SELECT):0
  min (Integer) = 14
  max (Integer) = 17
@rouault
Copy link
Member

rouault commented Oct 16, 2023

@jratike80 This might be data dependent. I don't reproduce with:

$ gdal_translate autotest/gcore/data/byte.tif test.mbtiles -outsize 1024 0
Input file size is 20, 20
0...10...20...30...40...50...60...70...80...90...100 - done.

$ gdalinfo test.mbtiles | grep zoom
minzoom=17
maxzoom=17

$ gdaladdo test.mbtiles 2 4 8
0...10...20...30...40...50...60...70...80...90...100 - done.

$ gdalinfo test.mbtiles | grep zoom
maxzoom=17
minzoom=14

@jratike80
Copy link
Collaborator Author

jratike80 commented Oct 16, 2023

My input file is 12000x12000 in EPSG:3067, yielding

Files: output.mbtiles
Size is 11138, 11153

The band description is
Overviews: 5569x5577, 2785x2788, 1392x1394, 696x697, 348x349, 174x174

I would guess that the issue can be triggered only if the last overview asked from gdaladdo is considerably bigger than the tile size. In my test I asked for 1392x1394 but also 696x697, 348x349, 174x174 are reported. If this theory is right, test with your small image and
gdaladdo test.mbtiles 2

@rouault rouault self-assigned this Oct 16, 2023
rouault added a commit that referenced this issue Oct 19, 2023
MBTiles: BuildOverviews(): correctly set minzoom metadata (fixes #8565)
rouault added a commit that referenced this issue Oct 19, 2023
[Backport release/3.7] MBTiles: BuildOverviews(): correctly set minzoom metadata (fixes #8565)
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