openlayers icon indicating copy to clipboard operation
openlayers copied to clipboard

Even bandsCount >= 5 in DataTileSource not working correctly

Open fabry24 opened this issue 2 years ago • 1 comments

Describe the bug Using even bandsCount >= 6 in DataTileSource generates incorrect output, when using last band as alpha channel. What we try to do

  1. Set layer style to show RGBA
  2. {color: ["color",["band", 4],["band", 3],["band", 2],["/", ["band", bands.length + 1], 255]]}
  3. Ask for 5 bands from titiler - you'll get 6bands (5bands + alpha) as output
  4. Set DataTileSource to work with 6 bands (5 + alpha)
  5. Alpha mask is not working correctly
  6. To fix this behavior we generated ol/DataTile with one more dimension, when working with even bandsCount:

To Reproduce Steps to reproduce the behavior:

  1. Change value of totalBandsCount (row: 24) directly to bandsCount (In this example it is 6).

Example https://codesandbox.io/s/numpytile-forked-e279im

fabry24 avatar May 24 '22 13:05 fabry24

I also encounter this with a 5 band GeoTIFF (returning 6 bands including the alpha). The workaround there is to explicitly specify the bands and duplicate one of them:

  sources: [
    {
      nodata: 0,
      bands; [1, 2, 3, 4, 5, 5],
      url: 'xxxx.tif',
    },
  ],

mike-000 avatar Aug 09 '22 14:08 mike-000