Working with Sentinel-2

Load necessary libraries

Let’s load some basic libraries to work with the data

renv::restore()
library(here)
library(dplyr)
library(ggplot2)
library(sf)
library(terra)
library(vapour)

Sentinel-2 tiles

First we query and plot all Sentinel tiles covering Germany.

dat <- sf::st_read('https://cloud.code-de.org:8080/swift/v1/AUTH_622a231224cb46c6982643e55e817c98/geojson/DE_S2.geojson')
Reading layer `DE_S2' from data source 
  `https://cloud.code-de.org:8080/swift/v1/AUTH_622a231224cb46c6982643e55e817c98/geojson/DE_S2.geojson' 
  using driver `GeoJSON'
Simple feature collection with 69 features and 1 field
Geometry type: POLYGON
Dimension:     XY
Bounding box:  xmin: 174139.8 ymin: 5190240 xmax: 1035431 ymax: 6200040
Projected CRS: WGS 84 / UTM zone 32N
dat |> 
  ggplot() + 
  geom_sf(colour = "black", fill = NA) + 
  theme_void()

BE8

dat <- sf::st_read('https://cloud.code-de.org:8080/swift/v1/AUTH_622a231224cb46c6982643e55e817c98/geojson/BE8_in_NI.geojson')
Reading layer `BE8_in_NI' from data source 
  `https://cloud.code-de.org:8080/swift/v1/AUTH_622a231224cb46c6982643e55e817c98/geojson/BE8_in_NI.geojson' 
  using driver `GeoJSON'
Simple feature collection with 965 features and 1 field
Geometry type: POLYGON
Dimension:     XY
Bounding box:  xmin: 324000 ymin: 5680000 xmax: 676000 ymax: 5992000
Projected CRS: WGS 84 / UTM zone 32N
dat |> 
  ggplot() + 
  geom_sf() + 
  theme_void()