[gdal-dev] Problem when using gdal_translate to create mbtiles

Renato Souza Sanabria renato.s.sanabria at gmail.com
Tue Feb 7 11:42:30 PST 2017


Hi,

I have two similar (but with different resolutions) .tif's that I'm trying
to convert to .mbtiles with gdal_translate. They both have 4 bands (RGBA),
but only one of them is converted correctly (all four bands). In the case
of the other one, the Alpha band is not converted and is removed in the
final file.

Does anybody have any idea of what might be happening? I've tried many
variations of the gdal_translate command and also other tiling scripts like
gdal2tiles.py, gdal2tilesp.py and gdal2tiles_parallel.py , but they don't
meet my needs. I'm using gdal 2.1.0

The metadata of the 2 .tifs, with the metadata of the converted mbtiles is
shown below.

*CORRECTLY CONVERTED*

*Driver: GTiff/GeoTIFF*
Files: 20160103_133809_2430410_RapidEye-1_visual.tif
Size is 5000, 5000
Coordinate System is:
PROJCS["WGS 84 / UTM zone 24S",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-39],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",10000000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","32724"]]
Origin = (379500.000000000000000,7936500.000000000000000)
Pixel Size = (5.000000000000000,-5.000000000000000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_DATETIME=2016:01:03 13:38:03
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (  379500.000, 7936500.000) ( 40d 8'33.10"W, 18d39'33.00"S)
Lower Left  (  379500.000, 7911500.000) ( 40d 8'38.58"W, 18d53' 6.25"S)
Upper Right (  404500.000, 7936500.000) ( 39d54'19.85"W, 18d39'37.65"S)
Lower Right (  404500.000, 7911500.000) ( 39d54'24.19"W, 18d53'10.96"S)
Center      (  392000.000, 7924000.000) ( 40d 1'28.93"W, 18d46'22.10"S)
Band 1 Block=512x512 Type=Byte, ColorInterp=Red
  Overviews: 1667x1667, 556x556
  Mask Flags: PER_DATASET ALPHA
  Overviews of mask band: 1667x1667, 556x556
Band 2 Block=512x512 Type=Byte, ColorInterp=Green
  Overviews: 1667x1667, 556x556
  Mask Flags: PER_DATASET ALPHA
  Overviews of mask band: 1667x1667, 556x556
Band 3 Block=512x512 Type=Byte, ColorInterp=Blue
  Overviews: 1667x1667, 556x556
  Mask Flags: PER_DATASET ALPHA
  Overviews of mask band: 1667x1667, 556x556
Band 4 Block=512x512 Type=Byte, ColorInterp=Alpha
  Overviews: 1667x1667, 556x556


---------------------------------------------------------------------------------------------------------

*Driver: MBTiles/MBTiles*
Files: converted.mbtiles
Size is 5558, 5592
Coordinate System is:
PROJCS["WGS 84 / Pseudo-Mercator",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["X",EAST],
    AXIS["Y",NORTH],
    EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0
+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext
 +no_defs"],
    AUTHORITY["EPSG","3857"]]
Origin = (-4468815.267360419966280,-2114849.003552540671080)
Pixel Size = (4.777314267823516,-4.777314267823516)
Metadata:
  ZOOM_LEVEL=15
  name=converted
  type=overlay
  description=converted
  version=1.1
  format=png

bounds=-40.14405056576531,-18.88638159422762,-39.90552708248893,-18.65916569743923
  minzoom=15
  maxzoom=15
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (-4468815.267,-2114849.004) ( 40d 8'38.58"W, 18d39'33.00"S)
Lower Left  (-4468815.267,-2141563.745) ( 40d 8'38.58"W, 18d53'10.97"S)
Upper Right (-4442262.955,-2114849.004) ( 39d54'19.90"W, 18d39'33.00"S)
Lower Right (-4442262.955,-2141563.745) ( 39d54'19.90"W, 18d53'10.97"S)
Center      (-4455539.111,-2128206.374) ( 40d 1'29.24"W, 18d46'22.12"S)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=256x256 Type=Byte, ColorInterp=Alpha

=========================================================================

*INCORRECTLY CONVERTED*

*Driver: GTiff/GeoTIFF*
Files: 20170123_094107_0c59_visual.tif
Size is 6629, 5546
Coordinate System is:
PROJCS["WGS 84 / UTM zone 24S",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-39],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",10000000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","32724"]]
Origin = (392598.000000000000000,7929114.000000000000000)
Pixel Size = (3.000000000000000,-3.000000000000000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_DATETIME=2017:01:23 09:41:07
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (  392598.000, 7929114.000) ( 40d 1' 7.51"W, 18d43'35.85"S)
Lower Left  (  392598.000, 7912476.000) ( 40d 1'10.77"W, 18d52'37.10"S)
Upper Right (  412485.000, 7929114.000) ( 39d49'48.48"W, 18d43'39.20"S)
Lower Right (  412485.000, 7912476.000) ( 39d49'51.13"W, 18d52'40.48"S)
Center      (  402541.500, 7920795.000) ( 39d55'29.47"W, 18d48' 8.24"S)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
  Overviews: 2210x1849, 737x617, 246x206
  Mask Flags: PER_DATASET ALPHA
  Overviews of mask band: 2210x1849, 737x617, 246x206
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
  Overviews: 2210x1849, 737x617, 246x206
  Mask Flags: PER_DATASET ALPHA
  Overviews of mask band: 2210x1849, 737x617, 246x206
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
  Overviews: 2210x1849, 737x617, 246x206
  Mask Flags: PER_DATASET ALPHA
  Overviews of mask band: 2210x1849, 737x617, 246x206
Band 4 Block=256x256 Type=Byte, ColorInterp=Alpha
  Overviews: 2210x1849, 737x617, 246x206

--------------------------------------------------------------------------------------------------------------------
*Driver: MBTiles/MBTiles*
Files: converted.mbtiles
Size is 8832, 7448
Coordinate System is:
PROJCS["WGS 84 / Pseudo-Mercator",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["X",EAST],
    AXIS["Y",NORTH],
    EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0
+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext
 +no_defs"],
    AUTHORITY["EPSG","3857"]]
Origin = (-4454967.915897197090089,-2122776.586719702463597)
Pixel Size = (2.388657133911758,-2.388657133911758)
Metadata:
  ZOOM_LEVEL=16
  name=converted
  type=overlay
  description=converted
  version=1.1
  format=png

bounds=-40.01965769112543,-18.87791211862349,-39.83014353096918,-18.72662381105138
  minzoom=16
  maxzoom=16
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (-4454967.916,-2122776.587) ( 40d 1'10.77"W, 18d43'35.85"S)
Lower Left  (-4454967.916,-2140567.305) ( 40d 1'10.77"W, 18d52'40.48"S)
Upper Right (-4433871.296,-2122776.587) ( 39d49'48.52"W, 18d43'35.85"S)
Lower Right (-4433871.296,-2140567.305) ( 39d49'48.52"W, 18d52'40.48"S)
Center      (-4444419.606,-2131671.946) ( 39d55'29.64"W, 18d48' 8.23"S)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue

-- 
Renato Sanabria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170207/6365ce98/attachment-0001.html>


More information about the gdal-dev mailing list