/TutorialGoogleEarthEngine-con-R

Introducción a Google Earth Engine con R

Primary LanguageR


Introducción a Google Earth Engine con R

rgee: An R package for interacting with Google Earth Engine

Cesar Aybar , Qiusheng Wu , Lesly Bautista , Roy Yali , and Antony Barja


Markdownify Markdownify

1. ¿Qué es GEE?

Google Earth Engine (GEE) es una plataforma gratis en la nube que esta diseñada para el análisis de datos espaciales a una escala planetaria que incorpora las capacidades computacionales masivas de Google. Esta plataforma integrada está diseñada para potenciar no solo a los científicos tradicionales de teledetección, sino también a una audiencia mucho mas amplia que carece de capacidad técnica necesaria para utilizar supercomputadoras tradicionales o recursos de computación en la nube de productos básicos a gran escala.

GEE Otros
Markdownify Markdownify Markdownify Markdownify Markdownify

2. Funcionamiento de rgee

image

3. Sintaxis de rgee

JS (Code Editor) Python R
var db = 'CGIAR/SRTM90_V4'
var image = ee.Image(db)
print(image.bandNames())
#> 'elevation'
import ee
ee.Initialize()
db = 'CGIAR/SRTM90_V4'
image = ee.Image(db)
image.bandNames().getInfo()
#> [u'elevation']
library(rgee)
ee_Initialize()
db <- 'CGIAR/SRTM90_V4'
image <- ee$Image(db)
image$bandNames()$getInfo()
#> [1] "elevation"

4. GEE- API

image

5. instalación de rgee

Si utilizas la versión 4.0 en el sistema operativo de Windows, de preferencia es recomendable tener instalado Rtools.

Para poder instalar rgee primero debemos instalar las librerías remotes y rstudioapi

install.packages('remotes')
install.packages('rstudioapi')
install.packages('rgee') 

instalamos los paquetes de rgee

library(rgee)
ee_install()
intalando miniconda
Would you like to install Miniconda? [Y/n]: Y
* Downloading "https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe" ...
probando la URL 'https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe'
Content type 'application/octet-stream' length 59801432 bytes (57.0 MB)
downloaded 57.0 MB
![image](https://user-images.githubusercontent.com/51866276/112393901-cc5e9d80-8cc9-11eb-9503-041e8a0f43ad.png)
# To activate this environment, use
#
#     $ conda activate r-reticulate
#
# To deactivate an active environment, use
#
#     $ conda deactivate

* Miniconda has been successfully installed at "C:/Users/Junior/AppData/Local/r-miniconda".
1. Removing the previous Python Environment (rgee), if it exists ...

2. Creating a Python Environment (rgee)
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done

rgee::ee_install want to store the environment variables: EARTHENGINE_PYTHON 
and EARTHENGINE_ENV in your .Renviron file to use the Python path:
C:\Users\Junior\AppData\Local\r-miniconda\envs\rgee\python.exe in future sessions.


Would you like to continues? [Y/n]:Y


3. The Environment Variable 'EARTHENGINE_PYTHON=C:\Users\Junior\AppData\Local\r-miniconda\envs\rgee\python.exe' 
was stored in the .Renviron file. Remember that you
could remove EARTHENGINE_PYTHON and EARTHENGINE_ENV using
rgee::ee_clean_pyenv().

4. Installing the earthengine-api. Running: 
reticulate::py_install(packages = 'earthengine-api', envname = 'C:/Users/Junior/AppData/Local/r-miniconda/envs/rgee')
Well done! rgee was successfully set up in your system.
You need restart R to see changes. After doing that, we recommend
run ee_check() to perform a full check of all non-R rgee dependencies.
Do you want restart your R session? 

1: yes
2: no

>1