feat: MBTiles: support custom raster zoom
Current state according to https://gdal.org/drivers/raster/mbtiles.html
Opening options
- Raster and vector: ZOOM_LEVEL=value
Creation options
- Raster only: ZOOM_LEVEL_STRATEGY=[AUTO/LOWER/UPPER]: Defaults to AUTO. Strategy to determine zoom level. [...] RESAMPLING=[NEAREST/BILINEAR/CUBIC/CUBICSPLINE/LANCZOS/MODE/AVERAGE]: Defaults to BILINEAR. Resampling algorithm.
- Vector only (GDAL >= 2.3): MINZOOM=
: Defaults to 0. Minimum zoom level at which tiles are generated. MAXZOOM= : Defaults to 5. Maximum zoom level at which tiles are generated. Maximum supported value is 22
so, I am not aware of any way to override zoom level, although the code in mbtilesdataset.cpp#3196 seems amenable to it.
In practice, an inattentive reader may try ZOOM_LEVEL or MINZOOM for creating a raster dataset, both will be silently ignored which is not great usability.
I understand the current code may be tailored to a single zoom level for rasters, but since it already knows how to up/downsample rasters, it seems a bit arbitrary to limit levels -1 (LOWER) to +1 (UPPER) instead of arbitrary levels eg ZOOM_LEVEL_STRATEGY=16, or ZOOM_LEVEL=16, or a new parameter .
I understand I can resample before but this is less ergonomic, can lower precision silently if I resample incorrectly, and can add extra disk space requirements for intermediate datasets.
https://github.com/OSGeo/gdal/pull/9101 could serve as a point of inspiration