Green City Script, PlanetScope

/*
Author of the script: Carlos Bentes
*/

// Normalized Difference Vegetation Index
var ndvi = (nir - red) / (nir + red);

// Threshold for vegetation
var veg_th = 0.4;

// Simple RGB
var R = red / 3000;
var G = green / 3000;
var B = blue / 3000;

// 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

The example data is using Planet Sandox data. This data is restricted to Sentinel Hub users with active paid plans. If you are already a Planet Customer, see here on how to get access.

General description of the script

Uses NDVI [1] to color PlanetScope 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 PlanetScope.

Author of the script

Carlos Bentes

Description of representative images

Visualization of the port of Hamburg with the Green City script. Acquisition date 2019-04-30, processed by Sentinel Hub. Green City script over Tallinn

References

[1] Normalized difference vegetation index: https://en.wikipedia.org/wiki/Normalized_difference_vegetation_index

Credits

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