GeoTIFF / georaster-layer-for-leaflet

Display GeoTIFFs and soon other types of raster on your Leaflet Map
https://geotiff.github.io/georaster-layer-for-leaflet-example/
Apache License 2.0
296 stars 58 forks source link

Working with Multibandraster #115

Open Lorano98 opened 1 year ago

Lorano98 commented 1 year ago
    @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.

pgenevski commented 1 year ago

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?