Introduction
This repository is a collection of 250+ R script examples. The majority of theses examples were adapted from the repos qgis-earthengine-examples and earthengine-py-notebooks. Would you like to contribute with your own examples? Please open an issue here attaching your reproducible script. I will upload as soon as possible to the website!
What is rgee?
rgee
is a binding package for calling Google Earth Engine API from within R. Additionally, several functions have been implemented to make simple the connection with the R spatial ecosystem.
rgee installation
Install the rgee
package from GitHub is quite simple, you just have to run in your R console as follows:
remotes::install_github("r-spatial/rgee")
rgee
depends on sf. Therefore, is necessary to install its external libraries, follow the installation steps specified here.
Docker image
docker pull csaybar/rgee
docker run -d -p 8787:8787 -e USER=rgee -e PASSWORD=rgee --name rgee-dev csaybar/rgee
After that, in your preferred browser, run:
127.0.0.1:8787
setup
Prior to using rgee
you will need to install a Python version higher than 3.5 in their system. rgee
counts with an installation function (ee_install) which helps to setup rgee
correctly:
library(rgee)
## It is necessary just once
ee_install()
# Initialize Earth Engine!
ee_Initialize()
Additionally, you might use the functions below for checking the status of rgee dependencies and delete credentials.
ee_check() # Check non-R dependencies
ee_clean_credentials() # Remove credentials of a specific user
ee_clean_pyenv() # Remove reticulate system variables
Also, consider looking at the setup section for more information on customizing your Python installation.
Examples
The Table of Contents below mimics the structure of the Google Earth Engine API Documentation. I strongly encourage you to check out the API Documentation if you need an in-depth explanation of each R example.
Get Started
Machine Learning
- Supervised Classification Algorithms
- Unsupervised Classification Algorithms
Image
- Image Overview
- Image Visualization
- Image information and metadata
- Mathematical operations
- Relational, conditional and Boolean operations
- Convolutions
- Morphological Operations
- Gradients
- Edge detection
- Spectral transformations
- Texture
- Object-based methods
- Cumulative Cost Mapping
- Registering Images
- Miscellaneous
- Band statistics (min, max, mean, std)
- Image statistics by band
- Extract value to points
- Rename bands
- Clipping
- Find image by path and row
- Get image resolution
- Get image extent
- Set image properties
- Select bands
- Convert bands to ImageCollection
- Reclassify
- Composite bands
- Image smoothing
- Download image
- Cell statistics
- Image patch area
- Get image id
- Get band name and type
- Filtering by calendar range
ImageCollection
Geometry, Feature, FeatureCollection
- Geometry Overview
- Geodesic vs. Planar Geometries
- Geometry Visualization and Information
- Geometric Operations
- Feature Overview
- FeatureCollection Overview
- Feature and FeatureCollection Visualization
- FeatureCollection Information and Metadata
- Filtering a FeatureCollection
- Mapping over a FeatureCollection
- Reducing a FeatureCollection
- Vector to Raster Interpolation
- Miscellaneous
- Add new attribute
- Add area column
- Add random value column
- Single column statistics
- Multiple column statistics
- Simplify polygons
- Column statistics by group
- Select by location
- Select by attributes
- Select by strings
- Vector symbology
- Merge FeatureCollection
- Search by buffer distance
- Select columns
- Mimimum bounding geometry
- Clipping polygons
Reducer
Join
Array
Specialized Algorithms
- Landsat Algorithms
- Sentinel-1 Algorithms
- Resampling and Reducing Resolution
- Pattern recognition
Asset Management
How Earth Engine Works
Filter
- Filter to metadata equal to the given value
- Filter to metadata not equal to the given value
- Filter on metadata contained in a list
- Filter on metadata that cotains a certain string
- Filter on metadata that starts with a certain string
- Filter on metadata that ends with a certain string
- Filter on metadata that falls within a specified range
Visualization
Datasets
- Terrain
- Water
- Vector datasets catalog
- Large Scale International Boundary Polygons (LSIB)
- TIGER: US 2018 Census Counties
- TIGER: US 2018 Census States
- TIGER: US 2016 Census Roads
- TIGER: US 2010 Census Blocks
- TIGER: US Census 2010 Census Tracts + Demographic Profile 1 aggregate statistics
- TIGER: US Census 2010 5-digit ZIP Code Tabulation Areas
- GLIMS: Global Land Ice Measurements from Space
- USGS Watershed Boundary Datasets
- USA EPA Ecoregions
- RESOLVE Ecoregions
- World Database on Protected Areas (WDPA)
- WRI Global Power Plant Database
- Landsat WRS-2 grid
Tutorials
RGEE examples
- Install rgee
- Download EE Images
- Download EE ImageCollections
- Download EE FeatureCollections
- Manage dates in EE objects
- Display Spatial EE objects
- Earth Engine assets with rgee
- Upload EE Spatial objects
- Time series with rgee + gganimate
- Obtain metadata about EE Spatial objects
- Basic Search module
- Demo #1: Preprocessing MODIS
- Demo #2: Preprocessing LANDSAT
- Demo #3: Preprocessing SENTINEL2
- Demo #4: Kriging with rgee and gstat
- Demo #5: Object-based Image Analysis + Random Forest
- Demo #6: Landsat Image Available: rgee + ggplot2
- Demo #7: Create a Deep Learning dataset with rgee