Utilizza l'API GDAL Python per generare mbtiles
Aug 19 2020
Voglio creare mbtiles con l'API GDAL Python. Come posso integrare opzioni specifiche del formato come "TILE_FORMAT = 'jpeg', QUALITY='90'"
per 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
Risposte
2 bugmenot123 Aug 19 2020 at 20:47
Quelle sono le opzioni di creazione . È possibile passare le opzioni di creazione gdal.Translate
utilizzando il creationOptions
parametro. I nomi sono gli stessi della gdal.TranslateOptions
funzione:https://gdal.org/python/osgeo.gdal-module.html#TranslateOptions
Devono essere key=value
coppie come stringhe in un elenco.
Per il tuo esempio:
creation_options = ["TILE_FORMAT=JPEG", "QUALITY=90"]
ds = gdal.Translate(
pathout, src_ds,
format='mbtiles', creationOptions=creation_options
)