I want to create mbtiles with the GDAL Python API. How can I integrate format specific options like "TILE_FORMAT = 'jpeg', QUALITY='90'" for mbtiles?

from osgeo import gdal

path = r'C:\Users\go\my.vrt'
pathout = r'C:\Users\go\my.mbtiles'
src_ds = gdal.Open(path)
ds = gdal.Translate(pathout , src_ds, format = 'mbtiles')
ds = No
  • You can pass them as parameter(s). See gis.stackexchange.com/questions/352643/… for some example. Commented Aug 19, 2020 at 12:07
  • that's do not work in my test. Because thats mbtiles specific options and not gdal.translate options that i want to add. i tested it with: ds = gdal.Translate(pathout , src_ds, format = 'mbtiles', TILE_FORMAT = 'jpeg', QUALITY='90')
    – David
    Commented Aug 19, 2020 at 12:21

1 Answer 1


Those are Creation Options. You can pass Creation Options to gdal.Translate using the creationOptions parameter. The names are the same as for the gdal.TranslateOptions function: https://gdal.org/python/osgeo.gdal-module.html#TranslateOptions

They are to be key=value pairs as strings in a list.

For your example:

creation_options = ["TILE_FORMAT=JPEG", "QUALITY=90"]

ds = gdal.Translate(
    pathout, src_ds, 
    format='mbtiles', creationOptions=creation_options
  • 1
    Thats it, but one little misstake: creationOptions = creation_options. Thanks!
    – David
    Commented Aug 19, 2020 at 14:18
  • Thaanks, fixed! Commented Aug 19, 2020 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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