0

UPDATE November 30, 2020

per request by @bugmenot123 I am updating the status of the gdaladdo problem:

After not finding a solution or work-around to the issue, I raised an issue (#3126) on the GitHub repo for GDAL (OSGeo/gdal). A repo contributor confirmed that the problem can be replicated with three commands:

gdal_create -outsize 16578 21503 -a_srs epsg:3857 -co tiled=yes -co    compress=deflate -a_ullr -10071418.950 3656755.453 -10071169.382 3656431.744 mbtest.tif

gdal_translate mbtest.tif mbtest.mbtiles -of MBTILES

gdaladdo mbtest.mbtiles
ERROR 6: zoom_level > 22 not supported

At this point it remains an unresolved issue.


ORIGINAL POST:

Trying to add zoom levels to an mbtile file using gdaladdo. But I get an error message:

ERROR 6: zoom_level > 22 not supported

I get the same error whether or not I specify zoom levels explicitly.

UPDATE Oct 29 2020

Based on input from the gdal dev mailing list, I tried the following steps:

Add a projection:

gdalwarp TLTR_crs.tif TLTR_crs_3857.tif -t_srs EPSG:3857

Create mbtiles:

gdal_translate TLTR_crs_3857.tif TLTR.mbtiles -of MBTILES

Add overviews implicitly:

gdaladdo TLTR.mbtiles

ERROR

ERROR 6: zoom_level > 22 not supported

So I am still getting the error.

PREVIOUSLY POSTED

STEPS:

  1. construct GTiff from tiff:

    gdal_translate -of 'GTiff' -a_srs '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' -a_ullr -90.473134 31.184680 -90.471041 31.182195 'TLTR.tif' 'TLTR_crs.tif'

  2. convert to mbtiles format:

    gdal_translate 'TLTR_crs.tif' 'TLTR.mbtiles' -of MBTILES

  3. add zoom levels:

    gdaladdo -r nearest 'TLTR.mbtiles' 12 14 16 18 20 22

Error message:

`ERROR 6: zoom_level > 22 not supported`

Try without explicit zoom levels:

gdaladdo -r nearest 'TLTR.mbtiles'

ERROR 6: zoom_level > 22 not supported

What could be causing this error?

EDIT: adding output from gdalinfo for TLTR.tif and TLTR crs.tif:

gdalinfo TLTR.tif
Warning 1: TIFFFetchNormalTag:Incompatible type for "RichTIFFIPTC"; tag ignored
Driver: GTiff/GeoTIFF
Files: TLTR.tif
Size is 21346, 25128
Coordinate System is `'
Metadata:
  TIFFTAG_DATETIME=2020:10:14 09:52:37
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
  TIFFTAG_SOFTWARE=Adobe Photoshop 21.2 (Macintosh)
  TIFFTAG_XRESOLUTION=72
  TIFFTAG_YRESOLUTION=72
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,25128.0)
Upper Right (21346.0,    0.0)
Lower Right (21346.0,25128.0)
Center      (10673.0,12564.0)
Band 1 Block=21346x3 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA 
Band 2 Block=21346x3 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA 
Band 3 Block=21346x3 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA 
Band 4 Block=21346x3 Type=Byte, ColorInterp=Alpha

gdalinfo TLTR_crs.tif
Driver: GTiff/GeoTIFF
Files: TLTR_crs.tif
Size is 21346, 25128
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (-90.473134000000002,31.184680000000000)
Pixel Size = (0.000000098051157,-0.000000098893664)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_DATETIME=2020:10:14 09:52:37
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
  TIFFTAG_SOFTWARE=Adobe Photoshop 21.2 (Macintosh)
  TIFFTAG_XRESOLUTION=72
  TIFFTAG_YRESOLUTION=72
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  ( -90.4731340,  31.1846800) ( 90d28'23.28"W, 31d11' 4.85"N)
Lower Left  ( -90.4731340,  31.1821950) ( 90d28'23.28"W, 31d10'55.90"N)
Upper Right ( -90.4710410,  31.1846800) ( 90d28'15.75"W, 31d11' 4.85"N)
Lower Right ( -90.4710410,  31.1821950) ( 90d28'15.75"W, 31d10'55.90"N)
Center      ( -90.4720875,  31.1834375) ( 90d28'19.52"W, 31d11' 0.38"N)
Band 1 Block=21346x1 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA 
Band 2 Block=21346x1 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA 
Band 3 Block=21346x1 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA 
Band 4 Block=21346x1 Type=Byte, ColorInterp=Alpha
(base) dogmat2 gdal results of transformations: 
1
  • 1
    It is really hard to see what is your latest status in your post now. Could you maybe restructure the post to state the remaining problems and then briefly talk about what was tried so far? Thanks! Nov 29, 2020 at 15:52

2 Answers 2

1

Your gdaladdo command is wrong according to documentation https://gdal.org/drivers/raster/mbtiles.html.

Overviews (raster)

gdaladdo / BuildOverviews() can be used to compute overviews. Only power-of-two overview factors (2,4,8,16,…) are supported.

However, the error message seems to reflect this limit in the vector tile side of the MBTiles driver

MAXZOOM=integer: Minimum zoom level at which tiles are generated. Defaults to the dataset creation option MAXZOOM value. Maximum supported value is 22

It is possible that there is a bug in GDAL and the wrong usage of gdaladdo is giving a misleading error message. The right message should be Only power of two overviews are supported. You may send mail to gdal-dev mailing list and ask.

0
1

As I am also experiencing the same issue as you, I would like to share my findings and a workaround.

It seems that the gdal_translate is creating mbtiles containing a level > 22 so gdaladdo (or gdalinfo as well) fail on subsequent reads since the mbdriver can only handle up to level 22.

My workaround is currently to downsample my source raster before generating the mbtiles. Using for example the following command (which is pretty coarse, you can probably calculate the factors in a better way).

gdal_translate -co NUM_THREADS=ALL_CPUS -r cubic -co BIGTIFF=YES -co COMPRESS=LZW -outsize 50% 50%  output.tif downsized.tif

When generating mbtiles from this raster, the new zoom level should end up being 22. (If not, repeat the command on the downsized raster or change the percentages)

I also wrote my findings on the bug tracker, hoping to get some more clarity on this. I hope my workaround can help with or solve your problem in the meanwhile.

Not the answer you're looking for? Browse other questions tagged or ask your own question.