Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Land Use Visualization for Sentinel-2 Using Linear Discriminant Analysis Script

Download Script

Evaluate and visualize

General description of the script

We have used LDA to create a visualization where each image channel (red, green and blue) codes the maximum information to identify respectively urban, crop and water related classes. Input class labels where taken from Spanish SIOSE land use classification. We have thus created three different transformations using LDA, one per component. Finally, as we have used a multiclass classifier for each type of data (for instance, urban data is separated into non urban, urban, industrial…), we transform the new axis obtained in order to translate the center of non-urban (resp. non-vegetation and non-water) classes to 0, and get the absolute value to recover any of the urban (resp. vegetation, water) classes that might have passed to the negative axis.

Details of the script

This script for EO Browser is specifically designed to visualize Sentinel-2 13 band data in a way that facilitates differentiation of urban areas (red channel), vegetation areas (green channel) and water areas (blue channel).

We have created our model in Python using LDA method of the scikit-learn library. For the input data, we have taken around 80 images of Sentinel-2 L1C and land use classification from Siose. All the images where taken from the Spanish region of La Rioja (with dates ranging from 2015 to 2019). The script consist of three components (RGB), each component is created by applying a different LDA to reduce the data to a single dimension for the corresponding color channel.

Given the way that the script is designed, it is expected that the urban areas will appear in red, the vegetation in green tones and the areas of water in blue, which appears to be the standard behaviour of the script. However we also see the appearance of red in certain crops, and some rivers might also appear in tones other than blue.

Authors of the script

Marta Elvira, Roberto Calvo, Javier Becerra

Description of representative images

In general, the colors for each zone are:

  • Urban areas: pink, orange.
  • Industrial: brigth purple.
  • Crops: purple and bright green tones.
  • Forests: dark greens.
  • No vegetation: yellow and pink.
  • Water: blue.
  • Snow: white.

The script example 1

The script example 2

The script example 3

The script example 4

The script example 5


[1] Scikit-learn, Linear Discriminant Analysis (LDA).

[2] GitHub repository, Collection of custom scripts.

[3] List of spectral indexes for Sentinel and Landsat.

[4] Borras, J. & Delegido, Jes˙s & Pezzola, Alejandro & Pereira, M. & Morassi, G. & Camps-Valls, Gustau. (2017). Clasificación de usos del suelo a partir de imágenes Sentinel-2. Revista de Teledeteccion.

[5] Pirotti, Francesco & Sunar, Filiz & Piragnolo, M.. (2016). BENCHMARK OF MACHINE LEARNING METHODS FOR CLASSIFICATION OF A SENTINEL-2 IMAGE. ISPRS - International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences.

[6] Anaya Isaza, Andres & Peluffo, Diego & Alvarado PÈrez, Juan & Rios, Jorge & Castro Silva, Juan Antonio & Rosero, Paul & PeÒa, Diego & Salazar Castro, Jose & Umaquinga, Ana. (2016). Estudio comparativo de mÈtodos espectrales para reducciÛn de la dimensionalidad: LDA versus PCA.

[7] GitHub repository.