Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

R Shiny App with R Google Earth Engine (RGEE)

This is an R Shiny application that integrates with Google Earth Engine (GEE) using RGEE for data visualization and analysis of landscape restoration impacts in Kenya. The app allows users to monitor changes in Net Primary Productivity (NPP) and Land Surface Temperature (LST) over time, and identify potential areas for future restoration efforts.

Below is an example of the dashboard interface developed for monitoring restoration impacts:

Dashboard Interface


Prerequisites

Before running the application, ensure you have the following:

  • R 4.4.3 or higher installed.
  • An active Google Earth Engine account (sign up at https://signup.earthengine.google.com/).
  • Python installed on your system (preferably via Anaconda).
  • RStudio for running the R code.

Steps to Run the Application

1. Install Required Packages

Start by installing the necessary R packages in your RStudio environment. Open a terminal or RStudio and run the following commands:

# Install R packages
install.packages(c("rgee", "dplyr", "ggplot2", "lubridate", "stringr", "shiny", "shinydashboard", "leaflet", "sf", "geojsonio"))

2. Create and Activate a Conda Environment

Create a new Conda environment to manage your Python dependencies for Google Earth Engine.

  • Open the Anaconda Prompt (or your terminal if Anaconda is installed).
  • Run the following command to create a new environment named gee:
conda create -n gee python=3.8
  • Activate the environment:
conda activate gee
  • Install the Google Earth Engine API within the gee environment:
pip install earthengine-api==0.1.317

3. Authenticate Google Earth Engine (GEE)

  • Inside RStudio, within the global.R file, activate the Conda environment using reticulate:
library(reticulate)
use_condaenv("gee")

# Load other required libraries
library(rgee)
library(dplyr)
library(ggplot2)
library(lubridate)
library(stringr)
library(shiny)
library(shinydashboard)
library(leaflet)
library(sf)
  • Once the environment is active, run the GEE initialization:
ee_Initialize()
  • This will redirect you to a Google login page. Sign in with your Google Earth Engine account.
  • After signing in, copy the authorization token provided.
  • Paste the token into the R console when prompted to verify your authentication.

4. Run the Application

After successful authentication:

  • The app will automatically start on http://127.0.0.1:5167. It may take up to 10 minutes to load.
  • Be patient as the app initializes and starts loading the data.

5. Interacting with the Application

Once loaded, the dashboard provides:

  • Interactive maps showing restored areas, reference zones, and potential restoration sites.
  • Time-series graphs comparing NPP and LST between restored and non-restored zones.

Example of NPP and LST time-series analysis during short rains:

NPP and LST Trends

Map showing bare ground frequency (2015–2024):

Bare Ground Frequency Map

Potential restoration areas identified via Random Forest modeling:

Potential Restoration Areas


Troubleshooting

  • Authentication Error: Ensure you’ve successfully authenticated and pasted the token into the R console.
  • Long Load Time: The app may take several minutes to initialize due to large dataset processing.

References

  • FAO. (2018). WaPOR Database Methodology: Level 2. Rome: FAO.
  • R Spatial. (2025). rgee: R Bindings for Google Earth Engine. GitHub.
  • Chang, W., et al. (2024). Shiny: Web Application Framework for R.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages