library(rgee)
library(tidyrgee)
library(sf)
library(terra)
library(raster)
library(stars)
library(viridis)
library(ggplot2)
library(mapview)
library(mlr3)
library(mlr3spatial)
ee_Initialize()
#> ββ rgee 1.1.5 βββββββββββββββββββββββββββββββββββββββ earthengine-api 0.1.326 ββ
#> β user: not_defined
#> β Initializing Google Earth Engine:
β Initializing Google Earth Engine: DONE!
#>
β Earth Engine account: users/ambarja
#> ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββπ΄ 1. Exploratory Spatial Data Analysis
1.1 Exploring dataset with rgee
The Earth Engine DataSet has several variables, in this example, we are going to visualize the night lights dataset.
# Setup the colour palette with the elevation values
viz = list(
min = 0,
max = 60,
palette = mako(n = 100)
)# Mapping the world elevation
ee$ImageCollection("NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG")$
select("avg_rad")$
filterDate("2021-01-01","2021-12-31")$
max() %>%
Map$addLayer(name = "Night light",visParams = viz) +
Map$addLegend(visParams = viz, name = "Elevation")Exploring the NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG dataset with tidyrgee
modis_ic <- ee$ImageCollection$Dataset$NOAA_VIIRS_DNB_MONTHLY_V1_VCMSLCFG |>
as_tidyee()head(modis_ic$vrt)
#> # A tibble: 6 Γ 8
#> id time_start systeβ¦ΒΉ date month year doy band_β¦Β²
#> <chr> <dttm> <chr> <date> <dbl> <dbl> <dbl> <list>
#> 1 NOAA/VIIRS/D⦠2014-01-01 00:00:00 201401⦠2014-01-01 1 2014 1 <chr>
#> 2 NOAA/VIIRS/D⦠2014-02-01 00:00:00 201402⦠2014-02-01 2 2014 32 <chr>
#> 3 NOAA/VIIRS/D⦠2014-03-01 00:00:00 201403⦠2014-03-01 3 2014 60 <chr>
#> 4 NOAA/VIIRS/D⦠2014-04-01 00:00:00 201404⦠2014-04-01 4 2014 91 <chr>
#> 5 NOAA/VIIRS/D⦠2014-05-01 00:00:00 201405⦠2014-05-01 5 2014 121 <chr>
#> 6 NOAA/VIIRS/D⦠2014-06-01 00:00:00 201406⦠2014-06-01 6 2014 152 <chr>
#> # β¦ with abbreviated variable names ΒΉβsystem_index, Β²βband_names