Index Visualization Script

function visualize_idx(band1, band2, gain) {
  let idx = index(band1, band2);
  return [idx, band1* gain, band2 * gain];
//let ndsi_viz = visualize_idx(B03, B12, 1);
//let ndwi_viz = visualize_idx(B08, B12, 1.5);
let ndvi_viz = visualize_idx(B08, B04, 2);
//let gndvi_viz = visualize_idx(B08, B03, 1);
//let bndvi_viz = visualize_idx(B08, B02, 1.5);
//let gbndvi_viz = visualize_idx(B08, B04+B03, 1);
return ndvi_viz;

Evaluate and Visualize

General description of the script

Universal script for visualization of indices. It’s creating a color composite of the index value and bands used for calculating the index.

Details of the script

It works for indices calculated as dividing an addition of two bands from the difference of two bands.

Author of the script

Martin Javorka

Description of representative images

1) The NDVI visualization of Liptov, Slovakia.

The script example 1

2) The NDSI visualization of the Danube Delta in summer, which nicely differentiates water (shown as red) from the land.

The script example 2