Contents
Is there a GDAL driver that supports MBTiles?
Starting with GDAL 2.1, the MBTiles driver has creation and write support for MBTiles raster datasets. Starting with GDAL 2.3, the MBTiles driver has read and write support for MBTiles vector datasets. For standalone Mapbox Vector Tile files or set of MVT files, see the MVT driver. Note: vector write support requires GDAL to be built with GEOS.
How to convert rasters to tiles in GDAL?
First, use gdal_translate to convert your raster layer to a tiles layer (see here for MBtile specific options). This will only create the highest zoom level. Gdal_translate determines this automatically based on the image resolution. I am not sure if/how you can set the desired maximum zoom level yourself (please leave a comment if you know how).
How to set maximum zoom for MBTiles in GDAL?
However that information being optional, if omitted, the driver will use the extent of the tiles at the maximum zoom level. The user can also specify the USE_BOUNDS=NO open option to force the use of the actual extent of tiles at the maximum zoom level. Or it can specify any of MINX/MINY/MAXX/MAXY to have a custom extent.
How to convert a raster layer to a MBTiles map?
Export: Converting a raster layer to a MBtiles map takes two steps. First, use gdal_translate to convert your raster layer to a tiles layer (see here for MBtile specific options). This will only create the highest zoom level. Gdal_translate determines this automatically based on the image resolution.
How to create MBTiles in Python using GDAL?
P.S. Starting with GDAL 2.1, the MBTiles driver has creation and write support for MBTiles datasets. So you can use gdal_translate to generate mbtiles with base zoom level (automaticaly defined). And then use gdaladdo to generate overviews. Gdal_translate is all you need and usage is documented in http://www.gdal.org/frmt_mbtiles.html.
How to generate TMS tiles in GDAL library?
GDAL library originaly provides gdal2tiles.py script to generate directories with TMS tiles. Also you can use gdal2tilesp with multiprocessing support. After tiles were generated you can load them into mbtiles database using mbutil.