[gdal-dev] Fwd: Creating MBTiles with transparent background from GeoTIFF

Kanishk Varshney varskann1993 at gmail.com
Mon Jun 27 05:21:43 PDT 2022


Hey all,

I am stuck with MBTiles creation from GeoTIFF files that have a black
background (RGB: 0,0,0).

In QGIS, I am able to generate MBTiles via the following steps:

   - Set Transparency pixel (0 0 0) to get a geotiff with transparent
   background
   - Use Generate XYZ tiles (MBTiles) tool to generate the MBTiles for the
   above generated geotiff.

I want to automate the workflow using python, but not able to achieve great
success.

The following commands are used:

gdal_translate -tr 0.035 0.035 -a_nodata none -of MBTILES file1.tif
file1.mbtiles


gdaladdo -r nearest file1.mbtiles 2 4 8 16


This results in following issues:

1. The generated mbtiles don't have all the resolutions that manually
generated MBTiles have

2. Background is still black, which is a big concern for my usecase


Any help or alternative would be appreciated. Attaching a sample
Geotiff for reference


 sample_geotiff.tif
<https://drive.google.com/file/d/1HJaw59FVEwG_9sEN8bvfeRw1GrawGnUb/view?usp=drive_web>


Thanks,

Kanishk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220627/94dd2061/attachment.htm>


More information about the gdal-dev mailing list