Plastic Greenhouse Index

//VERSION=3
function setup() {
  return {
    input: ["B02","B03", "B04", "B08", "dataMask"],
    output:[
      { id: "default", bands: 3 },
      { id: "index", bands: 1, sampleType: "FLOAT32" },
      { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" },
      { id: "dataMask", bands: 1 }
    ] 
  };
}

//setting constants
const minVal = 0;
const maxVal = 1.5;
const threshold = 0.13;
const opacity = 1;

const visualizer = ColorGradientVisualizer.createBlueRed(minVal, maxVal);
visualizer.process(0.1)
visualizer.process(0.25)
visualizer.process(0.3)
visualizer.process(0.75)
visualizer.process(1.25)

function evaluatePixel(sample) {
  let index = (sample.B02 / (1 - ((sample.B02 + sample.B03 + sample.B08)/3)));
  let color = visualizer.process(index);
  let RGB = [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02];
  return {
    default: (index > threshold) ? [color[0], color[1], color[2]] : RGB,
    index: [index],
    eobrowserStats: [index],
    dataMask: [sample.dataMask]
  };
}

Evaluate and Visualize

Adding examples

This page shows how example links can be added by defining the parameters in the front matter. An example is defined like this:

examples:
- zoom: '10'
  lat: '42.76703'
  lng: '11.22847'
  datasetId: S2L2A
  fromTime: '2020-07-12T00:00:00.000Z'
  toTime: '2020-07-12T23:59:59.999Z'
  platform:
  - CDSE
  - EOB
  evalscripturl: https://custom-scripts.sentinel-hub.com/custom-scripts/sentinel-2/ndvi/eob.js

General description of the script

A simple spectral index for the detection of plastic greenhouses and agricultural foil, based on the Retrogressive Plastic Greenhouse Index developed by Ibrahim et al (2021). Plastic foil reflects strongly in Band 2 (Blue) of Sentinel-2, which is compared against the mean of bands 3 (green), 4 (red) and 8 (near infrared). Detection is not perfect - bare soil areas are sometimes mistaken.

The script assigns a blue to red palette to values of the retrogressive plastic greenhouse index that exceed a certain threshold, and true color to the rest of the pixels.

Description of representative images

Plastic Greenhouse Index map of the “Sea of Plastic”, an area dominated by plastic greenhouses in the Almería region of Spain. As you can see, the index is not selective to land cover (bare soil and coastal areas are labelled), but can be used to separate open and greenhouse horticulture and can contribute to agricultural mapping.

'Sentinel-2 10 August 2025, in Almería, Spain'

References

  • Ibrahim, Elsy, and Anne Gobin. “Sentinel-2 recognition of uncovered and plastic covered agricultural soil.” Remote Sensing 13, no. 21 (2021): 4195. Link