georaster-layer-for-leaflet icon indicating copy to clipboard operation
georaster-layer-for-leaflet copied to clipboard

Working with Multibandraster

Open Lorano98 opened this issue 2 years ago • 1 comments

    @khannurien , how many bands does your raster have?

If it's a simple 3-Band RGB raster you could do:

pixelValuesToColorFn: values => values[0] === -99.0 ? null : `rgb(${values[0]},${values[1]},${values[2]})`

If it's a four-band RGBA raster, you could do:

pixelValuesToColorFn: values => values[0] === -99.0 ? null : `rgba(${values[0]},${values[1]},${values[2]},${values[3]/255})`

If it's not 3 or 4-bands, things get more complicated, but I'm happy to help.

Please let me know if it works or if you have any other questions. I'd like to improve the documentation to make it more clear. Thanks!!

Originally posted by @DanielJDufour in https://github.com/GeoTIFF/georaster-layer-for-leaflet/issues/16#issuecomment-516669695


As you mentioned above it is complicated to handle rasters with more than 4 bands. But how can i do that? My raster has 10 bands.

Lorano98 avatar Dec 01 '22 12:12 Lorano98

Do you mean converting a 10 band pixel to a 3 band (RGB) pixel, or something like calculating e.g. an NDVI out of some of the bands?

pgenevski avatar Jul 31 '23 13:07 pgenevski