R Works with Google Earth Engine - Installation 【rgee】
Date : 2022/04/24
Intallation Tutorial - Reference : Introduction to rgee (r-project.org)
Prerequisites :
1. A registered GEE acoount
2. A unrestricted-access VPN for google
3. A python package-management software , such as Anaconda
3. R and Rstudio
Process :
1. Install the 'rgee' package
2. Set up the dependent environment
3. Initialization
Step 1 : Install the 'rgee' package
First, start you Rtudio and create a new R file. Before your installation , set up your python interpreter in Rstudio.
! If you met with the following problem , try what the above picture shows.
> library(rgee)
Error: package or namespace load failed for ‘rgee’:
loadNamespace() 'rgee' .onLoad failed:
code: py_module_import(module, convert = convert)
error: ModuleNotFoundError: No module named 'ee'
Then install the 'rgee' package. Here is where you can install ,check and update the R packages.
Step 2 : Set up the dependent environment
Now, we load the package, set up the python environment.
1 2 3 4 5 6 | library (rgee) #set up the python environment, do follow the prompt, enter [y] to restart R session. # ! Only need set up one time, if set up successfully, you don't have to write this line code again. ee_install () # if this doesn't work , try the next line code ee_install (py_env = "rgee" ) # if this doesn't work , try the next line code ee_install_set_pyenv (py_env = "rgee" ) |
After that , we need check out if all done.
1 | ee_check () |
Return Success Symbol :
(*) Python version
√ [Ok] D:/Anaconda3/envs/rgee/python.exe v3.8
(*) Python packages:
√ [Ok] numpy
√ [Ok] earthengine-api
! If don't , maybe the rgee and earthengine-api version doesn't match, just update your rgee package in Rstudio.
Step 3 : Initialization
Here is the Big Big Problem .
1 | ee_Initialize () # You need to do it every time after loading the 'rgee' library. |
Normally, you may encounter the following two problems:
√ email: not_defined
√ Initializing Google Earth Engine:
Error in py_call_impl(callable, dots$args, dots$keywords) :
1. TimeoutError: timed out [WinError 10060]
2. URLError: <urlopen error [WinError 10060]
I googled some solutions, but they didn't work, perhaps these attempts will solve your problems
1 2 3 4 5 6 7 8 | ## Solution 1 : clean up the environment then initialize ee_clean_pyenv () ee_Initialize () ## Solution 2 : Set the proxy then initialize Sys.setenv (http_proxy= 'http://127.0.0.1:7890' ) Sys.setenv (https_proxy= 'http://127.0.0.1:7890' ) ee_Initialize () |
Finally , I figured out the solution. It was unwise that I did not set system proxy , I just set up the browser proxy.
So, please make sure system proxy set up, then the initialization will succeess.
Step 4 : Enjoy working R with GEE
[ ^_^ ] If you have any problems , please comment on the box below.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)