Green City - Pansharpened Script, SPOT

let weight = (B2 + B1 + B0 * 0.4) / 2.4;
if (weight == 0) {
 return [0, 0, 0];
let ratio = PAN/weight * 2.5;
Author of the script: Carlos Bentes

// Normalized Difference Vegetation Index
var ndvi = (B3-B2)/(B3+B2);

// Threshold for vegetation
var veg_th = 0.4;

// Simple RGB
var R = (B2/10000)*ratio;
var G = (B1/10000)*ratio
var B = (B0/10000)*ratio

// Transform to Black and White
var Y = 0.2*R + 0.7*G + 0.1*B;
var pixel = [Y, Y, Y];

// Change vegetation color
if(ndvi >= veg_th)
  pixel = [0.1*Y, 1.8*Y, 0.1*Y];

return pixel;

Evaluate and visualize

As Airbus SPOT is commercial data, brought into Sentinel Hub as Bring Your Own Data, direct EO Browser and Sentinel Playgorund links are not possible due to the personalized data credentials.

General description of the script

Uses NDVI [1] to color SPOT images and create awareness of green areas in cities around the World. The script was modified to fit PlanetScope spectral bands. See also Green City for Pleiades.

Author of the script

Carlos Bentes

Description of representative images

Visualization of the port of Zgornje Konjišče, Slovenia with the Green City script. Green City script of Zgornje Konjišče, Slovenia


[1] Normalized difference vegetation index:


Y. Zha, J. Gao & S. Ni (2003) Use of normalized difference built-up index in automatically mapping urban areas from TM imagery, International Journal of Remote Sensing, 24:3, 583-594, DOI: 10.1080/01431160304987