MBTiles driver should support pixel tile dimensions other than 256x256
|Reported by:||kthujvu||Owned by:||warmerdam|
"The MBTiles specification https://github.com/mapbox/mbtiles-spec/blob/master/1.2/spec.md does not say anything about how many pixels a tile should contain. Specification defines the grid but all that is said about the BLOB that contains the image data is that it must be either jpeg or png image and therefore a MBTiles database with 512x512 sized tiles is totally valid."
GDAL indeed has hard-coded 256x256 tile dimensions. This means it does not support tiles in double resolution which are not rare nowadays (eg available as "retina" or "@2x" at some tile providers).
Trying to gdalinfo a non-256 mbtiles file gives "ERROR 6: Unsupported tile characteristics".
While the specs are sparse, I would consider it a bug that GDAL has the dimensions hardcoded. I assume the best way would be to not care about the dimensions at all.
Attached is a bash script that (using imagemagick/graphicsmagick and mb-util) creates tiles and mbtiles with 128x128, 256x256 and 512x512 pixels.