Opened 3 years ago

Closed 4 months ago

Last modified 4 months 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 Changed 3 years ago by Even Rouault

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 Changed 4 months ago by Even Rouault

Resolution: fixed
Status: newclosed

In 41707:

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

comment:3 Changed 4 months ago by Even Rouault

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