CRAN R-CMD-check Codecov test coverage


Spectral reflectance visualisations for user-defined areas

See our vignette for detailed usage examples.

Authors: Oleh Prylutskyi, Vladimir Mikryukov, Dariia Shyriaieva


This package provides tools for obtaining, processing, and visualization of satellite-derived spectral reflectance data for the user-defined polygons of earth surface classes, allowing to explore visually in which wavelengths the classes differ. Input should be a shapefile with polygons of surface classes (it might be polygons of different habitat types, crops, or any other things). We use Sentinel2 L2A satellite mission (only optical bands) as a source of spectral reflectance data, obtained through the Google Earth Engine service.

The workflow depends on rgee R package, which provides a bridge between R and Python API for Google Earth Engine. All the operations with satellite images run in a cloud, and the obtained pixel data is visualized locally afterward. Therefore, the most resource-hungry operations do not overload your local machine despite the extent of input data. But that means that you need a stable Internet connection for using API.

The overall workflow is following:

  1. Load the user’s ESRI shapefile containing polygons for user-defined surface classes, as well as the text or numerical field with classes names (labels).

  2. Apply rgee functionality to retrieve multi-band pixel data for classes polygons from the Google Earth Engine service.

  3. Visualize retrieved pixel data locally, mainly using ggplot2 approach.

Overall workflow

Essential requirements:


Install the released version from CRAN


You can install the development version of spectralR like so:


spectralR is strongly depends on rgee and sf packages, so install and configure them before installing spectralR. More details in the vignette.

Output examples

Spectral reflectance curves for user-defined set of habitat types
Reflectance per bands for user-defined set of habitat types
Density of values (as violin plots) for selected habitat types per band


Shyriaieva, D., Prylutskyi, O. (2021). Exploratory analysis of the spectral reflectance curves of habitat types: a case study on Southern Bug River valley, Ukraine. In: 63rd IAVS Annual Symposium: Book of Abstracts, p. 153.