Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#7233 closed defect (fixed)

MBTiles driver should support pixel tile dimensions other than 256x256

Reported by: kthujvu Owned by: warmerdam
Priority: normal Milestone: 2.3.0
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords: mbtiles
Cc:

Description

An answer to https://gis.stackexchange.com/questions/270978/mbtiles-with-512x512-pixel-tiles says

"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.

Attachments (1)

create_tiles.sh (768 bytes ) - added by kthujvu 6 years ago.
script to create tiles and mbtiles

Download all attachments as: .zip

Change History (3)

by kthujvu, 6 years ago

Attachment: create_tiles.sh added

script to create tiles and mbtiles

comment:1 by Even Rouault, 6 years ago

Resolution: fixed
Status: newclosed

In 41449:

MBTiles: support opening and creating datasets with tiles whose dimension is not 256 (fixes #7233)

comment:2 by Even Rouault, 6 years ago

Milestone: 2.3.0
Note: See TracTickets for help on using tickets.