Opened 9 years ago

Closed 6 years ago

Last modified 6 years ago

#6119 closed enhancement (fixed)

Correct detection of MBTiles tile format

Reported by: Martin Mikita Owned by: warmerdam
Priority: normal Milestone: 2.3.0
Component: default Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

We are producing MBTiles with optimized PNG8 with transparency. Mostly inner tiles are only PNG8 (without transparency), but border tiles sometimes has transparency.

MBTilesDataset class detects number of bands from the center tile. It results in incorrect interpretation of tiles inside MBTiles.

I am not sure, what should be the correction:

  1. check more tiles (center, 2 corners, any random?)
  2. check more random tiles
  3. parse metadata first (type: overlay or baselayer, format: png or jpg)
    • overlay png format should be 4 bands.

As workaround we set MBTILES_BAND_COUNT to 4 for each MBTiles format, which is working for us now. (Even with baselayer jpg tiles inside).

Change History (3)

comment:1 by Even Rouault, 9 years ago

As it seems that the autodetection logic cannot work reliably, I woulnd't be opposed if you propose a patch to implement the same behaviour as GPKG :

<p>By default, the driver will expose a GeoPackage dataset as a four band (Red,Green, Blue,Alpha) dataset, which gives the maximum compatibility with the various encodings of tiles that can be stored. It is possible to specify an explicit number of bands with the BAND_COUNT opening option.</p>

comment:2 by Even Rouault, 6 years ago

Resolution: fixed
Status: newclosed

In 41707:

MBTiles: default to opening as RGBA (fixes #6119)

comment:3 by Even Rouault, 6 years ago

Milestone: 2.3.0
Note: See TracTickets for help on using tickets.