I am using gdal_translate to convert a fairly large geoTiff to MBTiles.

As the geoTiff is reprojected, it is not square anymore in Google Mercator and the parts that are not covered appear black when I would like them to be transparent.

I think it could have something to do with the -a_nodata parameter and I have tried with "-a_nodata 0", but it did not change things.

I have tried with both PNG8 and PNG. It did not change things either.

Here is what my command looks like:

gdal_translate -a_nodata 0 -of MBTILES -co TILE_FORMAT=PNG8 France.tif france.mbtiles

Any idea what I am doing wrong?

  • Just a question; when you reprojected your GeoTiff, did you specify something like -dstnodata "255 255 255 0" to set transparency for the empty space? (I am assuming you data has RGBA bands, as you are trying to make MBTiles-PNG).
    – Kazuhito
    Nov 12, 2016 at 11:27
  • @Kazuhito, I have not reprojected my GeoTIFF to google Mercator, should I ? I will try that.
    – jmc34
    Nov 13, 2016 at 8:29
  • Apologies. I assumed the second paragraph of your question was suggesting reprojection as part of your workflow. But, if you can, yes please try to set alpha band and see what happens.
    – Kazuhito
    Nov 13, 2016 at 8:51
  • Setting alpha band alone may not solve your issue. I feel this post How to add alpha chanel to mbtiles in gdal_translate? can be of interest to you.
    – Kazuhito
    Nov 13, 2016 at 9:25


Your Answer

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