├── .Rbuildignore
├── .gitattributes
├── .gitignore
├── .travis.yml
├── DESCRIPTION
├── NAMESPACE
├── R
├── auth.R
├── download.R
├── ee_grab.R
├── ee_grab_install.R
├── ee_products.R
├── helpers.R
├── install.R
└── request_data.R
├── README.html
├── README.md
├── _pkgdown.yml
├── codecov.yml
├── data
├── VG250_KRS-geom.dbf
├── VG250_KRS-geom.prj
├── VG250_KRS-geom.shp
├── VG250_KRS-geom.shx
├── VG250_KRS.cpg
├── VG250_KRS.dbf
├── VG250_KRS.prj
├── VG250_KRS.shp
├── VG250_KRS.shx
├── aerial-stripes.dbf
├── aerial-stripes.prj
├── aerial-stripes.qpj
├── aerial-stripes.shp
├── aerial-stripes.shx
├── custom.geo.json
├── map.geojson
├── map.kml
├── not-valid.shp
├── segments_part.geojson
├── territories.dbf
├── territories.prj
├── territories.shp
├── territories.shx
├── test-data.dbf
├── test-data.prj
├── test-data.shp
└── test-data.shx
├── developer-logs.md
├── docs
├── authors.html
├── developer-logs.html
├── docsearch.css
├── docsearch.js
├── earthEngineGrabR.html
├── index.html
├── link.svg
├── pkgdown.css
├── pkgdown.js
├── pkgdown.yml
└── reference
│ ├── activate_environments.html
│ ├── clean_environments.html
│ ├── clean_spaces.html
│ ├── create_collection_product.html
│ ├── create_image_product.html
│ ├── delete_credentials.html
│ ├── delete_if_exist.html
│ ├── delete_on_drive.html
│ ├── download_data.html
│ ├── eeProduct_chirps_precipitation.html
│ ├── eeProduct_jrc_distanceToWater.html
│ ├── eeProduct_modis_nonTreeVegetation.html
│ ├── eeProduct_modis_nonVegetated.html
│ ├── eeProduct_modis_treeCover.html
│ ├── eeProduct_oxford_accessibility.html
│ ├── eeProduct_oxford_friction.html
│ ├── eeProduct_srtm_elevation.html
│ ├── eeProduct_srtm_slope.html
│ ├── ee_data_collection.html
│ ├── ee_data_image.html
│ ├── ee_grab.html
│ ├── ee_grab_install.html
│ ├── find_file.html
│ ├── find_folder.html
│ ├── gd_auth.html
│ ├── get_credential_root.html
│ ├── get_data.html
│ ├── get_data_info.html
│ ├── get_ft_id_gd.html
│ ├── get_name_from_path.html
│ ├── get_product_info.html
│ ├── get_temp_path.html
│ ├── import_data.html
│ ├── index.html
│ ├── install_ee_dependencies.html
│ ├── install_ee_dependencies_workaround.html
│ ├── is_type.html
│ ├── request_data.html
│ ├── run_ee_oauth.html
│ ├── run_ft_oauth.html
│ ├── run_gd_oauth.html
│ ├── run_oauth_all.html
│ ├── skip_test_if_not_possible.html
│ ├── test_anaconda.html
│ ├── test_credentials.html
│ ├── test_dependencies.html
│ ├── test_for_gdal_workaround.html
│ ├── test_gdal_installation.html
│ ├── test_import_ee_gdal_conda.html
│ ├── test_import_ee_gdal_virtual.html
│ ├── test_python.html
│ ├── test_virtual_env.html
│ ├── upload_as_ft.html
│ ├── upload_data.html
│ └── wait_for_file_on_drive.html
├── earthEngineGrabR.Rproj
├── earthEngineGrabR.md
├── inst
└── Python
│ ├── access_id.py
│ ├── dev_functions.py
│ ├── ee_authorisation_function.py
│ ├── ee_get_data.py
│ ├── final.py
│ ├── get_info.py
│ ├── get_info_test.py
│ ├── test-errors.py
│ ├── test_get_data.py
│ ├── tests.py
│ └── upload.py
├── man
├── ee_data_collection.Rd
├── ee_data_image.Rd
├── ee_grab.Rd
├── ee_grab_install.Rd
├── request_data.Rd
└── sticker
│ └── ee sticker_cropped.jpg
└── tests
├── testthat.R
└── testthat
├── setup-test.R
├── teardown-test-environment.R
├── test-OAuth.R
├── test-download.R
├── test-ee_grab.R
├── test-ee_product.R
├── test-install.R
├── test-request_data.R
├── test-setup.R
└── test-tokens
├── credentials
├── ft_credentials.json
└── gd-credentials.rds
/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^appveyor\.yml$
2 | ^codecov\.yml$
3 | ^docs$
4 | ^_pkgdown\.yml$
5 | ^.*\.Rproj$
6 | ^\.Rproj\.user$
7 | ^\.httr-oauth$
8 | ^~/\.config/earthengine/\.httr-oauth$
9 | ^/home/jesjehle/\.config/earthengine/\.httr-oauth$
10 | ^C:/Users/de\.student/Documents/\.config/earthengine/\.httr-oauth$
11 | ^C:/Users/Katharina/Documents/\.config/earthengine/\.httr-oauth$
12 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | data/* binary
3 | src/* text=lf
4 | R/* text=lf
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .Rproj.user
2 | .Rhistory
3 | .RData
4 | .earthEngineGrabR.Rproj
5 | *.pyc
6 | .httr-oauth
7 | path.csv
8 | /data/poly.*
9 | ~/.config/earthengine/.httr-oauth
10 | /home/jesjehle/.config/earthengine/.httr-oauth
11 | C:/Users/de.student/Documents/.config/earthengine/.httr-oauth
12 | C:/Users/Katharina/Documents/.config/earthengine/.httr-oauth
13 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: r
2 | r:
3 | - oldrel
4 | - release
5 | - devel
6 |
7 | cache: packages
8 | sudo: required
9 | dist: trusty
10 | warnings_are_errors: false
11 |
12 | r_packages:
13 | - covr
14 |
15 | addons:
16 | apt:
17 | sources:
18 | - sourceline: 'ppa:ubuntugis/ubuntugis-unstable'
19 |
20 | before_install:
21 | # install sf dependencies
22 | - sudo apt-get update
23 | - sudo apt-get install libudunits2-dev libgdal-dev libgeos-dev libproj-dev
24 | # install anaconda
25 | - wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh -O anaconda.sh
26 | - bash anaconda.sh -b -p $HOME/anaconda
27 | - export PATH="$HOME/anaconda/bin:$PATH"
28 | - hash -r
29 | - conda config --set always_yes yes --set changeps1 no
30 | # move credentials
31 | - mkdir ~/.config/earthengine
32 | - mv -v tests/testthat/test-tokens/* ~/.config/earthengine/
33 | # install r packages manually, otherwise R cmd check wont find them
34 | - Rscript -e 'install.packages("KernSmooth", lib="/home/travis/R-bin/lib/R/library")'
35 | - Rscript -e 'install.packages("sf", lib="/home/travis/R-bin/lib/R/library")'
36 | - Rscript -e 'install.packages("reticulate", lib="/home/travis/R-bin/lib/R/library")'
37 | - Rscript -e 'install.packages("googledrive", lib="/home/travis/R-bin/lib/R/library")'
38 |
39 | before_script:
40 | - R CMD INSTALL .
41 | - R -e 'earthEngineGrabR::ee_grab_install(clean_credentials = F)'
42 |
43 | after_success:
44 | - Rscript -e 'library(covr); codecov()'
45 |
46 |
--------------------------------------------------------------------------------
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: earthEngineGrabR
2 | Title: Simplify the acquisition of remote sensing data
3 | Version: 0.2.0.0
4 | Authors@R: c(
5 | person("Janusch", "Jehle", email = "JesJehle@gmx.de", role = c("aut", "cre")),
6 | person("Severin", "Hauenstein", email = "severin.hauenstein@biom.uni-freiburg.de", role = c("aut"))
7 | )
8 | Description: The earthEngineGrabR is an interface between R and the GEE, to extracts data from the Earth Engine Data Catalog in a user-defined target area and a user-defined aggregation process.
9 | License: GPL-3
10 | SystemRequirements: Anaconda3 (>=5.2.0)
11 | BugReports: https://github.com/JesJehle/earthEngineGrabR/issues
12 | URL: https://jesjehle.github.io/earthEngineGrabR
13 | Encoding: UTF-8
14 | LazyData: true
15 | RoxygenNote: 6.1.0
16 | Depends:
17 | R (>= 3.0)
18 | imports:
19 | googledrive,
20 | reticulate
21 | Suggests:
22 | devtools,
23 | testthat,
24 | roxygen2
25 |
26 |
--------------------------------------------------------------------------------
/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 | export(check_processing)
4 | export(check_scale)
5 | export(check_status)
6 | export(ee_data_collection)
7 | export(ee_data_image)
8 | export(ee_grab)
9 | export(ee_grab_install)
10 | export(get_data)
11 | export(request_data)
12 | export(set_resolution)
13 |
--------------------------------------------------------------------------------
/R/download.R:
--------------------------------------------------------------------------------
1 |
2 | #' wait_for_file_on_drive
3 | #' @param filename name of the file to scan drive for
4 | #' @noRd
5 | wait_for_file_on_drive <- function(filename, verbose = T) {
6 | test <- try(googledrive::drive_find(filename, verbose = F), silent = T)
7 |
8 | while (nrow(test) < 1) {
9 | Sys.sleep(1)
10 | if (verbose) cat(".")
11 | test <- try(googledrive::drive_find(filename, verbose = F), silent = T)
12 | }
13 | return(T)
14 | }
15 |
16 |
17 |
18 | #' download_data
19 | #' @param ee_response Output of the request_data function.
20 | #' @param clear If the file should be removed from Google Drive after the download.
21 | #' @noRd
22 | #' @return nothing
23 | download_data <- function(ee_response,
24 | clear = T,
25 | verbose = T,
26 | temp_path) {
27 | for (i in seq_along(ee_response)) {
28 | if (i == 1) {
29 | if (verbose) {
30 | cat("\nwaiting for Earth Engine", "\n")
31 | }
32 | }
33 |
34 | path_full <- file.path(temp_path, ee_response[i])
35 |
36 | wait_for_file_on_drive(ee_response[i])
37 |
38 | if (verbose == T) {
39 | cat("\n")
40 | }
41 | googledrive::drive_download(
42 | file = ee_response[i],
43 | path = path_full,
44 | overwrite = T,
45 | verbose = F
46 | )
47 |
48 | if (verbose) {
49 | cat(paste0("\ndownload: ", get_name_from_path(ee_response[i]), "\n"))
50 | }
51 | # delete folder
52 | if (clear) {
53 | googledrive::drive_rm(ee_response[i], verbose = F)
54 | }
55 | }
56 | }
57 |
58 |
59 |
60 | #' import data
61 | #' @param productList List of data files produced in the ee_grab function
62 | #' @param verbose If true, messages reporting the processing state are printed.
63 | #' @return nothing
64 | #' @noRd
65 | import_data <- function(product_list, verbose = T, temp_path) {
66 |
67 | # product_list <- unlist(productList)
68 |
69 | downloads <- list.files(temp_path)
70 | downloads_clean <- grep("geojson", downloads, value = T)
71 |
72 | while (sum(product_list %in% downloads_clean) != length(product_list)) {
73 | if (verbose) cat("\nwaiting for Earth Engine", "\n")
74 | if (verbose) cat(".")
75 | Sys.sleep(2)
76 | downloads <- list.files(temp_path)
77 | downloads_clean <- grep("geojson", downloads, value = T)
78 | }
79 |
80 | ## import data
81 | if (verbose) cat("\nimport: finished", "\n")
82 | join <- sf::st_read(file.path(temp_path, downloads_clean[1]), quiet = TRUE)
83 | file.remove(file.path(temp_path, downloads_clean[1]))
84 | if (length(downloads_clean) > 1) {
85 | for (i in 2:length(downloads_clean)) {
86 | data <- sf::st_read(file.path(temp_path, downloads_clean[i]), quiet = TRUE)
87 | file.path(temp_path, downloads_clean[i])
88 | data_no_geom <- sf::st_set_geometry(data, NULL)
89 | join <- merge(join, data_no_geom)
90 | }
91 | }
92 | return(join)
93 | # if(clean) unlink(temp_path, recursive = T)
94 | }
95 |
--------------------------------------------------------------------------------
/R/ee_grab_install.R:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | #' Install dependencies and run authentications
7 | #'
8 | #' @param clean_credentials \code{logical}, if \code{True} already present credential are deleted recreated by a reauthenticate. Default is set to \code{True}.
9 | #' @param clean_environment \code{logical}, if \code{True} already installed environments are deleted to be reinstalled again. Default is set to \code{False}.
10 | #' @description \code{ee_grab_install()} installs the required dependencies and guides the user through the authentication processes to activate the different API's.
11 | #' @export
12 | #'
13 | #'
14 | #' @section Installation of Dependencies:
15 | #'
16 | #' To encapsulate the dependencies from the user's system and simplify the installation, the \code{earthEngineGrabR} uses a conda environment.
17 | #' By running \code{ee_grab_install()} first a conda environemt "earthEngineGrabR" is created.
18 | #' All Further all dependencies are installed inside the "earthEngineGrabR" environment.
19 | #'
20 |
21 | #' @section Authentication of API's:
22 | #'
23 | #' The earthEngineGrabR connects to 3 Google API's:
24 | #'
25 | #' \href{https://www.gdal.org/drv_gft.html}{Google Fusion Table} API for uploading data.
26 | #'
27 | #' \href{https://developers.google.com/earth-engine/}{Google Earth Engine} API for data aquisition and processing.
28 | #'
29 | #' \href{https://github.com/tidyverse/googledrive}{Google Drive} API for data download.
30 | #'
31 | #' To authenticate to the API's the user has to log in with his google account and allow the API to access data on googles servers on the user's behalf.
32 | #' To simplify this procedure the ee_grab_install function successively opens a browser window to log into the Google account.
33 | #' If the Google account is verified and the permission is granted, the user is directed to an authentification token. This token is manually copied and pasted into the R console, which creates persistent credentials.
34 | #' This process is repeated for each API. If the function runs successfully, all needed credentials are stored for further sessions and there should be no need for further authentification.
35 | #'
36 | #'
37 | ee_grab_install <-
38 | function(clean_credentials = T,
39 | clean_environment = F) {
40 | library(reticulate)
41 | # install dependencies -----------------------------------------------------------------------------------------
42 |
43 | # initialize environments
44 | conda_env_name <- "earthEngineGrabR"
45 |
46 | # if clean_environment is set to true already an existing environment is deleted
47 | if (clean_environment)
48 | clean_environments(conda_env_name)
49 |
50 | # test if environment for dependeicies already exists
51 | env_test <- grepl(conda_env_name, conda_list()$name)
52 |
53 | # install dependencies via an anaconda environment if test is not treu
54 | if (!sum(env_test) > 0) {
55 | tryCatch({
56 | conda_create(envname=conda_env_name)
57 | conda_install(envname=conda_env_name, package="earthengine-api", forge = TRUE)
58 | },
59 | error = function(err)
60 | stop(paste("Installation problem\n", err), call. = F))
61 | }
62 |
63 | # install dependencies via an anaconda environment if test is not treu
64 | # if (!sum(env_test) > 0) {
65 | # tryCatch({
66 | # if (Sys.info()[["sysname"]] != "Linux") {
67 | # conda_create(conda_env_name, packages = c("Python = 2.7", "gdal"))
68 | #
69 | # conda_install(conda_env_name, packages = c("earthengine-api", "shapely"))
70 | #
71 | # } else {
72 | #
73 | # conda_create(conda_env_name,
74 | # packages = c("Python = 2.7", "gdal=2.1.0", "geos=3.5.0"))
75 | # conda_install(conda_env_name,
76 | # packages = c("earthengine-api", "shapely", 'oauth2client'))
77 | # }},
78 | # error = function(err)
79 | # stop(paste("Installation problem\n", err), call. = F)
80 | #
81 | # )
82 | # }
83 | use_condaenv(conda_env_name, required = TRUE)
84 |
85 | # test import of all modules.
86 | tryCatch({
87 | test_ee <- py_module_available("ee")
88 |
89 | if (!test_ee)
90 | stop("Module ee could not be imported", call. = F)
91 |
92 | }, error = function(err) {
93 | test_python()
94 | test_anaconda()
95 | stop(paste("Installation problem\n", err), call. = F)
96 | },
97 | warning = function(w) {
98 | warning(w)
99 | })
100 |
101 | # run authentication ---------------------------------------------------------------
102 |
103 | # if no credential are found run authentication
104 | if (!test_credentials(with_error = F)) {
105 | run_oauth_all()
106 | } else {
107 | # if credential are found but clean_credentials is set to true, credentials are deleted and recreated during a new authentication
108 | if (clean_credentials) {
109 | delete_credentials()
110 | run_oauth_all()
111 | }
112 | }
113 | cat(
114 | "\n \nThe required dependencies are installed and all API's are authenticated for further sessions.\nThere should be no need to run ee_grab_install() again."
115 | )
116 | }
117 |
--------------------------------------------------------------------------------
/R/helpers.R:
--------------------------------------------------------------------------------
1 |
2 | #' skips test in testthat evaluation if requirement are not met. The function tests for credentials python modules and test files on google drive
3 | #' @noRd
4 | skip_test_if_not_possible <- function() {
5 |
6 | # skip_on_cran()
7 | credentials_test <- try(test_credentials(), silent = T)
8 | if (!credentials_test) skip(paste("Testing is not possible. \n", "credentials: ", credentials_test))
9 | # test the installation of required python modules
10 |
11 | #module_test_ee <- test_import_ee_gdal_conda()
12 |
13 | #module_test <- module_test_conda[[1]] | module_test_virtual[[1]]
14 |
15 | #if (!module_test) skip(paste("Testing is not possible. \n", "modules: ", module_test))
16 |
17 | # test environment
18 | ## check test data on google drive and upload if neccessary
19 |
20 | }
21 |
22 |
23 | #' delete_on_drive
24 | #' @param filename ldkjsf
25 | #' @noRd
26 | delete_on_drive <- function(filename) {
27 | gd_auth()
28 | test <- nrow(googledrive::drive_find(filename, verbose = F)) > 0
29 | if (test) googledrive::drive_rm(filename)
30 | }
31 |
32 |
33 | #' get_temp_path
34 | #' @description creates folder and returns path for the storage of local temp files, if folder alreday exists it gets deleted and new created.
35 | #' @param create logical weather to create a new folder
36 | #' @noRd
37 | get_temp_path <- function(create = T) {
38 | path <- file.path(dirname(tempdir()), "earthEngineGrabR-tmp")
39 | if (create) {
40 | if (dir.exists(path)) unlink(path, recursive = T)
41 | dir.create(path)
42 | }
43 | return(path)
44 | }
45 |
46 |
47 | #' is_type
48 | #' @description test of param is of type type and raises an appropriate error
49 | #' @param param the parameter to test
50 | #' @param type the required type of the parameter
51 | #' @noRd
52 | is_type <- function(param, type, null = FALSE) {
53 | if (is.null(null)) {
54 | if (
55 | class(param) != type &
56 | !is.null(param)
57 | ) {
58 | stop(paste(deparse(substitute(param)), "must be of class", type, "or", "NULL"), call. = F)
59 | }
60 | } else {
61 | if (class(param) != type)
62 | stop(paste(deparse(substitute(param)), "must be of class", type), call. = F)
63 | }
64 | }
65 |
66 |
67 | #' get_name_from_path
68 | #' @param path A file path
69 | #' @return basename without extension
70 | #' @noRd
71 | get_name_from_path <- function(path) {
72 | name <- tools::file_path_sans_ext(basename(path))
73 | return(name)
74 | }
75 |
76 |
77 |
78 | #' Add quotes to paths with spaces
79 | #' @noRd
80 | clean_spaces <- function(path) {
81 | if (length(grep(" ", path) > 0)) {
82 | path <- shQuote(path)
83 | }
84 | return(path)
85 | }
86 |
--------------------------------------------------------------------------------
/R/install.R:
--------------------------------------------------------------------------------
1 |
2 |
3 | # tests ---------------------------------------------------------------------------------------------------------------------------------------
4 |
5 |
6 | #' test anaconda installation
7 | #' @noRd
8 | test_anaconda <- function() {
9 | conda_test <- try(reticulate::conda_list(), silent = T)
10 | if (class(conda_test) == "try-error") {
11 | stop("No Anaconda is found on the system, on Windows and Mac the earthEngineGrabR library depends on an Anacona environment so please install Anaconda Python first: \n https://www.anaconda.com/download")
12 | }
13 | }
14 |
15 |
16 | #' test python installation
17 | #' @noRd
18 | test_python <- function() {
19 | python_test <- try(reticulate::py_available(initialize = T), silent = T)
20 | if (!python_test) {
21 | stop("No Python version is found \nTo use the earthEngineGrabR library first install Anaconda Python \nTo install Anaconda and Python go to: \n https://www.anaconda.com/download")
22 | }
23 | }
24 |
25 | # activations ------------------------------------------------------------------------------------------------------------------------------------
26 |
27 | #' clean virtual and conda environments
28 | #' @noRd
29 | clean_environments <- function(env_name = "earthEngineGrabR") {
30 | try(reticulate::conda_remove(env_name))
31 | #try(reticulate::virtualenv_remove(env_name))
32 | }
33 |
--------------------------------------------------------------------------------
/_pkgdown.yml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/_pkgdown.yml
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | comment: false
2 |
3 | coverage:
4 | status:
5 | project:
6 | default:
7 | target: auto
8 | threshold: 1%
9 | patch:
10 | default:
11 | target: auto
12 | threshold: 1%
13 |
14 | comment: false
15 | language: R
16 | sudo: false
17 | cache: packages
18 | after_success:
19 | - Rscript -e 'covr::codecov()'
20 |
--------------------------------------------------------------------------------
/data/VG250_KRS-geom.dbf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/VG250_KRS-geom.dbf
--------------------------------------------------------------------------------
/data/VG250_KRS-geom.prj:
--------------------------------------------------------------------------------
1 | PROJCS["UTM_Zone_32_Northern_Hemisphere",GEOGCS["GCS_GRS 1980(IUGG, 1980)",DATUM["D_unknown",SPHEROID["GRS80",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",9],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter",1]]
--------------------------------------------------------------------------------
/data/VG250_KRS-geom.shp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/VG250_KRS-geom.shp
--------------------------------------------------------------------------------
/data/VG250_KRS-geom.shx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/VG250_KRS-geom.shx
--------------------------------------------------------------------------------
/data/VG250_KRS.cpg:
--------------------------------------------------------------------------------
1 | UTF-8
--------------------------------------------------------------------------------
/data/VG250_KRS.dbf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/VG250_KRS.dbf
--------------------------------------------------------------------------------
/data/VG250_KRS.prj:
--------------------------------------------------------------------------------
1 | PROJCS["ETRS_1989_UTM_Zone_32N",GEOGCS["GCS_ETRS_1989",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",9.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
--------------------------------------------------------------------------------
/data/VG250_KRS.shp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/VG250_KRS.shp
--------------------------------------------------------------------------------
/data/VG250_KRS.shx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/VG250_KRS.shx
--------------------------------------------------------------------------------
/data/aerial-stripes.dbf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/aerial-stripes.dbf
--------------------------------------------------------------------------------
/data/aerial-stripes.prj:
--------------------------------------------------------------------------------
1 | PROJCS["WGS_1984_UTM_Zone_36S",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",33],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["Meter",1]]
--------------------------------------------------------------------------------
/data/aerial-stripes.qpj:
--------------------------------------------------------------------------------
1 | PROJCS["WGS 84 / UTM zone 36S",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",33],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32736"]]
2 |
--------------------------------------------------------------------------------
/data/aerial-stripes.shp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/aerial-stripes.shp
--------------------------------------------------------------------------------
/data/aerial-stripes.shx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/aerial-stripes.shx
--------------------------------------------------------------------------------
/data/custom.geo.json:
--------------------------------------------------------------------------------
1 | {"type":"FeatureCollection","features":[{"type":"Feature","properties":{"scalerank":1,"featurecla":"Admin-0 country","labelrank":2,"sovereignt":"France","sov_a3":"FR1","adm0_dif":1,"level":2,"type":"Country","admin":"France","adm0_a3":"FRA","geou_dif":0,"geounit":"France","gu_a3":"FRA","su_dif":0,"subunit":"France","su_a3":"FRA","brk_diff":0,"name":"France","name_long":"France","brk_a3":"FRA","brk_name":"France","brk_group":null,"abbrev":"Fr.","postal":"F","formal_en":"French Republic","formal_fr":null,"note_adm0":null,"note_brk":null,"name_sort":"France","name_alt":null,"mapcolor7":7,"mapcolor8":5,"mapcolor9":9,"mapcolor13":11,"pop_est":64057792,"gdp_md_est":2128000,"pop_year":-99,"lastcensus":-99,"gdp_year":-99,"economy":"1. Developed region: G7","income_grp":"1. High income: OECD","wikipedia":-99,"fips_10":null,"iso_a2":"FR","iso_a3":"FRA","iso_n3":"250","un_a3":"250","wb_a2":"FR","wb_a3":"FRA","woe_id":-99,"adm0_a3_is":"FRA","adm0_a3_us":"FRA","adm0_a3_un":-99,"adm0_a3_wb":-99,"continent":"Europe","region_un":"Europe","subregion":"Western Europe","region_wb":"Europe & Central Asia","name_len":6,"long_len":6,"abbrev_len":3,"tiny":-99,"homepart":1,"filename":"FRA.geojson"},"geometry":{"type":"MultiPolygon","coordinates":[[[[-52.55642473001839,2.504705308437053],[-52.93965715189498,2.124857692875622],[-53.418465135295264,2.053389187016037],[-53.554839240113495,2.334896551925965],[-53.77852067728889,2.376702785650053],[-54.08806250671728,2.105556545414629],[-54.52475419779975,2.311848863123785],[-54.27122962097578,2.738747870286943],[-54.18428402364474,3.194172268075235],[-54.01150387227682,3.622569891774858],[-54.399542202356514,4.212611395683481],[-54.47863298197922,4.896755682795643],[-53.95804460307093,5.756548163267809],[-53.618452928264844,5.646529038918402],[-52.88214128275408,5.409850979021599],[-51.82334286152593,4.565768133966145],[-51.65779741067888,4.156232408053029],[-52.24933753112398,3.241094468596287],[-52.55642473001839,2.504705308437053]]],[[[9.560016310269134,42.15249197037957],[9.229752231491773,41.38000682226445],[8.77572309737536,41.58361196549444],[8.54421268070783,42.25651662858308],[8.746009148807588,42.62812185319396],[9.390000848028905,43.00998484961474],[9.560016310269134,42.15249197037957]]],[[[3.588184441755715,50.37899241800358],[4.28602298342514,49.907496649772554],[4.799221632515753,49.98537303323633],[5.674051954784885,49.52948354755745],[5.897759230176376,49.44266714130717],[6.186320428094206,49.46380280211446],[6.658229607783539,49.20195831969155],[8.099278598674772,49.01778351500337],[7.593676385131062,48.33301911070373],[7.46675906742223,47.620581976911865],[7.192202182655535,47.44976552997099],[6.736571079138088,47.54180125588289],[6.768713820023634,47.28770823830368],[6.037388950228972,46.72577871356191],[6.022609490593567,46.272989813820516],[6.500099724970454,46.42967275652944],[6.843592970414562,45.99114655210067],[6.802355177445662,45.70857982032867],[7.096652459347837,45.333098863295874],[6.749955275101711,45.02851797136759],[7.007562290076663,44.25476675066139],[7.549596388386163,44.12790110938482],[7.435184767291843,43.69384491634918],[6.529245232783068,43.12889232031836],[4.556962517931396,43.39965098731158],[3.10041059735272,43.075200507167125],[2.985998976258486,42.47301504166989],[1.826793247087181,42.34338471126566],[0.701590610363922,42.79573436133265],[0.338046909190581,42.579546006839564],[-1.502770961910471,43.03401439063049],[-1.901351284177735,43.42280202897834],[-1.384225226232957,44.02261037859017],[-1.193797573237362,46.014917710954876],[-2.225724249673789,47.06436269793821],[-2.963276129559574,47.570326646507965],[-4.491554938159481,47.95495433205642],[-4.592349819344747,48.68416046812695],[-3.295813971357745,48.901692409859635],[-1.616510789384932,48.644421291694584],[-1.933494025063254,49.776341864615766],[-0.98946895995536,49.347375800160876],[1.338761020522753,50.12717316344526],[1.6390010921385,50.946606350297515],[2.513573032246171,51.14850617126185],[2.658422071960331,50.79684804951566],[3.123251580425716,50.78036326761452],[3.588184441755715,50.37899241800358]]]]}}]}
--------------------------------------------------------------------------------
/data/map.geojson:
--------------------------------------------------------------------------------
1 | {"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[8.67919921875,48.99463598353405],[7.855224609374999,49.210420445650286],[7.84423828125,48.019324184801185],[8.876953125,48.06339653776211],[8.67919921875,48.99463598353405]]]}}]}
--------------------------------------------------------------------------------
/data/map.kml:
--------------------------------------------------------------------------------
1 | #55555521#5555550.58.338623046874998,48.99463598353405 10.17333984375,47.41322033016902 12.15087890625,48.75618876280552 10.074462890625,48.58205840283824 10.162353515625,49.24629332459796 9.404296875,49.37522008143603 8.61328125,49.410973199695846 7.723388671875,49.396675075193976 7.3828125,48.777912755501845 7.899169921874999,48.05605376398125 8.580322265624998,48.180738507303836 8.338623046874998,48.99463598353405
--------------------------------------------------------------------------------
/data/not-valid.shp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/not-valid.shp
--------------------------------------------------------------------------------
/data/segments_part.geojson:
--------------------------------------------------------------------------------
1 | {
2 | "type": "FeatureCollection",
3 | "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
4 | "features": [
5 | { "type": "Feature", "id": 0, "properties": { "ID": "ts1p1", "SC": "AGO_Lui", "CC": "AGO" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 21.0424, -16.855 ], [ 21.0424, -16.8785 ], [ 21.041, -16.8785 ], [ 21.041, -16.855 ], [ 21.0424, -16.855 ] ] ], [ [ [ 21.0444, -16.855 ], [ 21.0458, -16.855 ], [ 21.0458, -16.8785 ], [ 21.0444, -16.8785 ], [ 21.0444, -16.855 ] ] ] ] } }
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/data/territories.dbf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/territories.dbf
--------------------------------------------------------------------------------
/data/territories.prj:
--------------------------------------------------------------------------------
1 | GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
--------------------------------------------------------------------------------
/data/territories.shp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/territories.shp
--------------------------------------------------------------------------------
/data/territories.shx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/territories.shx
--------------------------------------------------------------------------------
/data/test-data.dbf:
--------------------------------------------------------------------------------
1 | v
2 | A Q W sitecode C P
AKG
--------------------------------------------------------------------------------
/data/test-data.prj:
--------------------------------------------------------------------------------
1 | GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
--------------------------------------------------------------------------------
/data/test-data.shp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/test-data.shp
--------------------------------------------------------------------------------
/data/test-data.shx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/data/test-data.shx
--------------------------------------------------------------------------------
/developer-logs.md:
--------------------------------------------------------------------------------
1 | # today
2 |
3 |
4 | # review ROpenScience to Do
5 | * change cat to message
6 |
7 | # implement features
8 | * implement export projection control
9 | * implement info option in ee_grab to extract formatted info about the data product if needed. -- not important
10 | * add extensibility functionality by separating ee data manipulation and allow the embedding of external scripts
11 | * implement manual use escape in the authorisation process, like in the httr package
12 | * implement byYear and byMonth feature
13 |
14 |
15 | # stabalise
16 | * make tmp folder on google drive independent with unique naming - to enable parallel test runs with matrix builds
17 | * test with a list of product IDs
18 | * clean up python files
19 |
20 | # bugs to fix
21 |
22 | * refresh credentials message
23 |
24 | # documentation
25 |
26 | * explain naming
27 | * website with getting started section
28 | * vignettes/tutorials
29 | * polish project - licence, sticker, DOI
30 |
31 | # workflow
32 |
33 | * search for data - with earth engine data catalog
34 | * grab data - with ee_grab(data = ee_data_*, targetArea = geo-file,
35 | * requested data is defiend by list of ee_data_* functions.
36 | * targetArea is defiend by a path to a local geo-file
37 |
38 | # issues
39 |
40 | * If earthEngineGrabR is installed before sf, sf will use the dependencies from the conda environment and crash.
41 | * sf::st_read() error unable to load shared object '/home/jesjehle/R/x86_64-pc-linux-gnu-library/3.4/sf/libs/sf.so':
42 | * Jussi bug report : my working directory in a local temporary drive "\\\\ATKK/home/j/juzmakin/Documents", Anaconda does not find the compiler information: Error: Could not find a valid conda environment.
43 |
44 | * Error in py_run_file_impl(file, local, convert) : OverflowError: Python int too large to convert to C long
45 |
46 |
47 | # error template
48 | 1. reason the error occured
49 | 2. how to fix it
50 |
51 | # rest
52 |
53 | The interface enables the use of Earth Engine (EE) as a backend-service to request datasets from the EE Data Catalog, while providing extensive control over temporal and spatial resolution. The package not only allows to extract specific aspects of the data, like in a regular databank but enables to generate new data by an aggregation process, controlled by the user.
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/docs/authors.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Authors • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
89 |
90 |
91 |
92 |
95 |
96 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/docs/docsearch.js:
--------------------------------------------------------------------------------
1 | $(function() {
2 |
3 | // register a handler to move the focus to the search bar
4 | // upon pressing shift + "/" (i.e. "?")
5 | $(document).on('keydown', function(e) {
6 | if (e.shiftKey && e.keyCode == 191) {
7 | e.preventDefault();
8 | $("#search-input").focus();
9 | }
10 | });
11 |
12 | $(document).ready(function() {
13 | // do keyword highlighting
14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */
15 | var mark = function() {
16 |
17 | var referrer = document.URL ;
18 | var paramKey = "q" ;
19 |
20 | if (referrer.indexOf("?") !== -1) {
21 | var qs = referrer.substr(referrer.indexOf('?') + 1);
22 | var qs_noanchor = qs.split('#')[0];
23 | var qsa = qs_noanchor.split('&');
24 | var keyword = "";
25 |
26 | for (var i = 0; i < qsa.length; i++) {
27 | var currentParam = qsa[i].split('=');
28 |
29 | if (currentParam.length !== 2) {
30 | continue;
31 | }
32 |
33 | if (currentParam[0] == paramKey) {
34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20"));
35 | }
36 | }
37 |
38 | if (keyword !== "") {
39 | $(".contents").unmark({
40 | done: function() {
41 | $(".contents").mark(keyword);
42 | }
43 | });
44 | }
45 | }
46 | };
47 |
48 | mark();
49 | });
50 | });
51 |
52 | /* Search term highlighting ------------------------------*/
53 |
54 | function matchedWords(hit) {
55 | var words = [];
56 |
57 | var hierarchy = hit._highlightResult.hierarchy;
58 | // loop to fetch from lvl0, lvl1, etc.
59 | for (var idx in hierarchy) {
60 | words = words.concat(hierarchy[idx].matchedWords);
61 | }
62 |
63 | var content = hit._highlightResult.content;
64 | if (content) {
65 | words = words.concat(content.matchedWords);
66 | }
67 |
68 | // return unique words
69 | var words_uniq = [...new Set(words)];
70 | return words_uniq;
71 | }
72 |
73 | function updateHitURL(hit) {
74 |
75 | var words = matchedWords(hit);
76 | var url = "";
77 |
78 | if (hit.anchor) {
79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor;
80 | } else {
81 | url = hit.url + '?q=' + escape(words.join(" "));
82 | }
83 |
84 | return url;
85 | }
86 |
--------------------------------------------------------------------------------
/docs/link.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
--------------------------------------------------------------------------------
/docs/pkgdown.css:
--------------------------------------------------------------------------------
1 | /* Sticky footer */
2 |
3 | /**
4 | * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/
5 | * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css
6 | *
7 | * .Site -> body > .container
8 | * .Site-content -> body > .container .row
9 | * .footer -> footer
10 | *
11 | * Key idea seems to be to ensure that .container and __all its parents__
12 | * have height set to 100%
13 | *
14 | */
15 |
16 | html, body {
17 | height: 100%;
18 | }
19 |
20 | body > .container {
21 | display: flex;
22 | height: 100%;
23 | flex-direction: column;
24 |
25 | padding-top: 60px;
26 | }
27 |
28 | body > .container .row {
29 | flex: 1 0 auto;
30 | }
31 |
32 | footer {
33 | margin-top: 45px;
34 | padding: 35px 0 36px;
35 | border-top: 1px solid #e5e5e5;
36 | color: #666;
37 | display: flex;
38 | flex-shrink: 0;
39 | }
40 | footer p {
41 | margin-bottom: 0;
42 | }
43 | footer div {
44 | flex: 1;
45 | }
46 | footer .pkgdown {
47 | text-align: right;
48 | }
49 | footer p {
50 | margin-bottom: 0;
51 | }
52 |
53 | img.icon {
54 | float: right;
55 | }
56 |
57 | img {
58 | max-width: 100%;
59 | }
60 |
61 | /* Typographic tweaking ---------------------------------*/
62 |
63 | .contents h1.page-header {
64 | margin-top: calc(-60px + 1em);
65 | }
66 |
67 | /* Section anchors ---------------------------------*/
68 |
69 | a.anchor {
70 | margin-left: -30px;
71 | display:inline-block;
72 | width: 30px;
73 | height: 30px;
74 | visibility: hidden;
75 |
76 | background-image: url(./link.svg);
77 | background-repeat: no-repeat;
78 | background-size: 20px 20px;
79 | background-position: center center;
80 | }
81 |
82 | .hasAnchor:hover a.anchor {
83 | visibility: visible;
84 | }
85 |
86 | @media (max-width: 767px) {
87 | .hasAnchor:hover a.anchor {
88 | visibility: hidden;
89 | }
90 | }
91 |
92 |
93 | /* Fixes for fixed navbar --------------------------*/
94 |
95 | .contents h1, .contents h2, .contents h3, .contents h4 {
96 | padding-top: 60px;
97 | margin-top: -40px;
98 | }
99 |
100 | /* Static header placement on mobile devices */
101 | @media (max-width: 767px) {
102 | .navbar-fixed-top {
103 | position: absolute;
104 | }
105 | .navbar {
106 | padding: 0;
107 | }
108 | }
109 |
110 |
111 | /* Sidebar --------------------------*/
112 |
113 | #sidebar {
114 | margin-top: 30px;
115 | }
116 | #sidebar h2 {
117 | font-size: 1.5em;
118 | margin-top: 1em;
119 | }
120 |
121 | #sidebar h2:first-child {
122 | margin-top: 0;
123 | }
124 |
125 | #sidebar .list-unstyled li {
126 | margin-bottom: 0.5em;
127 | }
128 |
129 | .orcid {
130 | height: 16px;
131 | vertical-align: middle;
132 | }
133 |
134 | /* Reference index & topics ----------------------------------------------- */
135 |
136 | .ref-index th {font-weight: normal;}
137 |
138 | .ref-index td {vertical-align: top;}
139 | .ref-index .alias {width: 40%;}
140 | .ref-index .title {width: 60%;}
141 |
142 | .ref-index .alias {width: 40%;}
143 | .ref-index .title {width: 60%;}
144 |
145 | .ref-arguments th {text-align: right; padding-right: 10px;}
146 | .ref-arguments th, .ref-arguments td {vertical-align: top;}
147 | .ref-arguments .name {width: 20%;}
148 | .ref-arguments .desc {width: 80%;}
149 |
150 | /* Nice scrolling for wide elements --------------------------------------- */
151 |
152 | table {
153 | display: block;
154 | overflow: auto;
155 | }
156 |
157 | /* Syntax highlighting ---------------------------------------------------- */
158 |
159 | pre {
160 | word-wrap: normal;
161 | word-break: normal;
162 | border: 1px solid #eee;
163 | }
164 |
165 | pre, code {
166 | background-color: #f8f8f8;
167 | color: #333;
168 | }
169 |
170 | pre code {
171 | overflow: auto;
172 | word-wrap: normal;
173 | white-space: pre;
174 | }
175 |
176 | pre .img {
177 | margin: 5px 0;
178 | }
179 |
180 | pre .img img {
181 | background-color: #fff;
182 | display: block;
183 | height: auto;
184 | }
185 |
186 | code a, pre a {
187 | color: #375f84;
188 | }
189 |
190 | a.sourceLine:hover {
191 | text-decoration: none;
192 | }
193 |
194 | .fl {color: #1514b5;}
195 | .fu {color: #000000;} /* function */
196 | .ch,.st {color: #036a07;} /* string */
197 | .kw {color: #264D66;} /* keyword */
198 | .co {color: #888888;} /* comment */
199 |
200 | .message { color: black; font-weight: bolder;}
201 | .error { color: orange; font-weight: bolder;}
202 | .warning { color: #6A0366; font-weight: bolder;}
203 |
204 | /* Clipboard --------------------------*/
205 |
206 | .hasCopyButton {
207 | position: relative;
208 | }
209 |
210 | .btn-copy-ex {
211 | position: absolute;
212 | right: 0;
213 | top: 0;
214 | visibility: hidden;
215 | }
216 |
217 | .hasCopyButton:hover button.btn-copy-ex {
218 | visibility: visible;
219 | }
220 |
221 | /* mark.js ----------------------------*/
222 |
223 | mark {
224 | background-color: rgba(255, 255, 51, 0.5);
225 | border-bottom: 2px solid rgba(255, 153, 51, 0.3);
226 | padding: 1px;
227 | }
228 |
229 | /* vertical spacing after htmlwidgets */
230 | .html-widget {
231 | margin-bottom: 10px;
232 | }
233 |
--------------------------------------------------------------------------------
/docs/pkgdown.js:
--------------------------------------------------------------------------------
1 | /* http://gregfranko.com/blog/jquery-best-practices/ */
2 | (function($) {
3 | $(function() {
4 |
5 | $("#sidebar")
6 | .stick_in_parent({offset_top: 40})
7 | .on('sticky_kit:bottom', function(e) {
8 | $(this).parent().css('position', 'static');
9 | })
10 | .on('sticky_kit:unbottom', function(e) {
11 | $(this).parent().css('position', 'relative');
12 | });
13 |
14 | $('body').scrollspy({
15 | target: '#sidebar',
16 | offset: 60
17 | });
18 |
19 | $('[data-toggle="tooltip"]').tooltip();
20 |
21 | var cur_path = paths(location.pathname);
22 | var links = $("#navbar ul li a");
23 | var max_length = -1;
24 | var pos = -1;
25 | for (var i = 0; i < links.length; i++) {
26 | if (links[i].getAttribute("href") === "#")
27 | continue;
28 | var path = paths(links[i].pathname);
29 |
30 | var length = prefix_length(cur_path, path);
31 | if (length > max_length) {
32 | max_length = length;
33 | pos = i;
34 | }
35 | }
36 |
37 | // Add class to parent , and enclosing if in dropdown
38 | if (pos >= 0) {
39 | var menu_anchor = $(links[pos]);
40 | menu_anchor.parent().addClass("active");
41 | menu_anchor.closest("li.dropdown").addClass("active");
42 | }
43 | });
44 |
45 | function paths(pathname) {
46 | var pieces = pathname.split("/");
47 | pieces.shift(); // always starts with /
48 |
49 | var end = pieces[pieces.length - 1];
50 | if (end === "index.html" || end === "")
51 | pieces.pop();
52 | return(pieces);
53 | }
54 |
55 | function prefix_length(needle, haystack) {
56 | if (needle.length > haystack.length)
57 | return(0);
58 |
59 | // Special case for length-0 haystack, since for loop won't run
60 | if (haystack.length === 0) {
61 | return(needle.length === 0 ? 1 : 0);
62 | }
63 |
64 | for (var i = 0; i < haystack.length; i++) {
65 | if (needle[i] != haystack[i])
66 | return(i);
67 | }
68 |
69 | return(haystack.length);
70 | }
71 |
72 | /* Clipboard --------------------------*/
73 |
74 | function changeTooltipMessage(element, msg) {
75 | var tooltipOriginalTitle=element.getAttribute('data-original-title');
76 | element.setAttribute('data-original-title', msg);
77 | $(element).tooltip('show');
78 | element.setAttribute('data-original-title', tooltipOriginalTitle);
79 | }
80 |
81 | if(Clipboard.isSupported()) {
82 | $(document).ready(function() {
83 | var copyButton = "";
84 |
85 | $(".examples, div.sourceCode").addClass("hasCopyButton");
86 |
87 | // Insert copy buttons:
88 | $(copyButton).prependTo(".hasCopyButton");
89 |
90 | // Initialize tooltips:
91 | $('.btn-copy-ex').tooltip({container: 'body'});
92 |
93 | // Initialize clipboard:
94 | var clipboardBtnCopies = new Clipboard('[data-clipboard-copy]', {
95 | text: function(trigger) {
96 | return trigger.parentNode.textContent;
97 | }
98 | });
99 |
100 | clipboardBtnCopies.on('success', function(e) {
101 | changeTooltipMessage(e.trigger, 'Copied!');
102 | e.clearSelection();
103 | });
104 |
105 | clipboardBtnCopies.on('error', function() {
106 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy');
107 | });
108 | });
109 | }
110 | })(window.jQuery || window.$)
111 |
--------------------------------------------------------------------------------
/docs/pkgdown.yml:
--------------------------------------------------------------------------------
1 | pandoc: 1.19.2.4
2 | pkgdown: 1.1.0.9000
3 | pkgdown_sha: dd7df10589bd8e24cd7cdef75f1f932726a8b185
4 | articles: []
5 |
6 |
--------------------------------------------------------------------------------
/docs/reference/activate_environments.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | activate environment — activate_environments • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
activate environment
104 |
105 |
106 |
107 |
activate_environments(env_name = "earthEngineGrabR")
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/clean_environments.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | clean virtual and conda environments — clean_environments • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
clean virtual and conda environments
104 |
105 |
106 |
107 |
clean_environments(env_name = "earthEngineGrabR")
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/clean_spaces.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Add quotes to paths with spaces — clean_spaces • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
Add quotes to paths with spaces
104 |
105 |
106 |
107 |
clean_spaces(path)
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/delete_credentials.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | deletes credentials to re initialize — delete_credentials • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
deletes credentials to re initialize
104 |
105 |
106 |
107 |
delete_credentials(credentials = c("gd-credentials.rds", "credentials",
108 | "ft_credentials.json"))
109 |
110 |
111 |
112 |
118 |
119 |
120 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
--------------------------------------------------------------------------------
/docs/reference/delete_if_exist.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | delete_if_exist — delete_if_exist • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
delete_if_exist
104 |
105 |
106 |
107 |
delete_if_exist(path)
108 |
109 |
Arguments
110 |
111 |
112 |
113 | path_file |
114 | path of file to check |
115 |
116 |
117 |
118 |
119 |
120 |
127 |
128 |
129 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
--------------------------------------------------------------------------------
/docs/reference/delete_on_drive.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | delete_on_drive — delete_on_drive • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
delete_on_drive
104 |
105 |
106 |
107 |
delete_on_drive(filename)
108 |
109 |
Arguments
110 |
111 |
112 |
113 | filename |
114 | ldkjsf |
115 |
116 |
117 |
118 |
119 |
120 |
127 |
128 |
129 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
--------------------------------------------------------------------------------
/docs/reference/gd_auth.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | retreves credentials and runs google drive authorisation via googledrive::drive_auth() — gd_auth • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
retreves credentials and runs google drive authorisation via googledrive::drive_auth()
104 |
105 |
106 |
107 |
gd_auth(credential_name = "gd-credentials.rds")
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/get_credential_root.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Find path to specified credentials folder — get_credential_root • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
Find path to specified credentials folder
104 |
105 |
106 |
107 |
get_credential_root()
108 |
109 |
Value
110 |
111 |
path to credentials folder
112 |
113 |
114 |
115 |
123 |
124 |
125 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
--------------------------------------------------------------------------------
/docs/reference/get_ft_id_gd.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | get_ft_id_gd extracts fusion table ID — get_ft_id_gd • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
get_ft_id_gd extracts fusion table ID
104 |
105 |
106 |
107 |
get_ft_id_gd(ft_name)
108 |
109 |
Arguments
110 |
111 |
112 |
113 | ft_name |
114 | Name of fusion table in google drive |
115 |
116 |
117 |
118 |
119 |
120 |
127 |
128 |
129 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
--------------------------------------------------------------------------------
/docs/reference/get_name_from_path.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | get_name_from_path — get_name_from_path • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
get_name_from_path
104 |
105 |
106 |
107 |
get_name_from_path(path)
108 |
109 |
Arguments
110 |
111 |
112 |
113 | path |
114 | A file path |
115 |
116 |
117 |
118 |
Value
119 |
120 |
basename without extension
121 |
122 |
123 |
124 |
133 |
134 |
135 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
--------------------------------------------------------------------------------
/docs/reference/get_product_info.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | get_product_info — get_product_info • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
Retrives Metadata of data product
104 |
105 |
106 |
107 |
get_product_info(prodct_id, path)
108 |
109 |
Arguments
110 |
111 |
112 |
113 | path |
114 | String, specifieng the path for the medata |
115 |
116 |
117 | product_id |
118 | String of the product id |
119 |
120 |
121 |
122 |
123 |
124 |
131 |
132 |
133 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
--------------------------------------------------------------------------------
/docs/reference/install_ee_dependencies.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | The function installs python dependencies — install_ee_dependencies • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
The function installs python dependencies
104 |
105 |
106 |
107 |
install_ee_dependencies(conda_env_name)
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/install_ee_dependencies_workaround.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | The function installs python dependencies — install_ee_dependencies_workaround • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
The function installs python dependencies
104 |
105 |
106 |
107 |
install_ee_dependencies_workaround(conda_env_name)
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/is_type.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | is_type — is_type • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
test of param is of type type and raises an appropriate error
104 |
105 |
106 |
107 |
is_type(param, type)
108 |
109 |
Arguments
110 |
111 |
112 |
113 | param |
114 | the parameter to test |
115 |
116 |
117 | type |
118 | the required type of the parameter |
119 |
120 |
121 |
122 |
123 |
124 |
131 |
132 |
133 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
--------------------------------------------------------------------------------
/docs/reference/run_ee_oauth.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Run ee authentication — run_ee_oauth • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
Run ee authentication
104 |
105 |
106 |
107 |
run_ee_oauth()
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/run_ft_oauth.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Run ft authentication — run_ft_oauth • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
Run ft authentication
104 |
105 |
106 |
107 |
run_ft_oauth()
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/run_gd_oauth.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Runs google drive authorisation via googledrive::drive_auth() and saves credentials — run_gd_oauth • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
Runs google drive authorisation via googledrive::drive_auth() and saves credentials
104 |
105 |
106 |
107 |
run_gd_oauth(credential_name = "gd-credentials.rds")
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/test_anaconda.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | test anaconda installation — test_anaconda • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
test anaconda installation
104 |
105 |
106 |
107 |
test_anaconda()
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/test_dependencies.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | test python and anaconda installation — test_dependencies • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
test python and anaconda installation
104 |
105 |
106 |
107 |
test_dependencies()
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/test_for_gdal_workaround.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | test python and virtual environment installation for gdal workaround — test_for_gdal_workaround • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
test python and virtual environment installation for gdal workaround
104 |
105 |
106 |
107 |
test_for_gdal_workaround()
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/test_gdal_installation.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | test local gdal installation for vir-env workaround — test_gdal_installation • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
test local gdal installation for vir-env workaround
104 |
105 |
106 |
107 |
test_gdal_installation()
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/test_import_ee_gdal_conda.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | test import of gdal and ee for conda — test_import_ee_gdal_conda • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
test import of gdal and ee for conda
104 |
105 |
106 |
107 |
test_import_ee_gdal_conda()
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/test_import_ee_gdal_virtual.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | test import of gdal and ee for virtual env — test_import_ee_gdal_virtual • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
test import of gdal and ee for virtual env
104 |
105 |
106 |
107 |
test_import_ee_gdal_virtual()
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/test_python.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | test python installation — test_python • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
test python installation
104 |
105 |
106 |
107 |
test_python()
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/test_virtual_env.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | test virtual environment installation — test_virtual_env • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
test virtual environment installation
104 |
105 |
106 |
107 |
test_virtual_env()
108 |
109 |
110 |
111 |
117 |
118 |
119 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/docs/reference/wait_for_file_on_drive.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | wait_for_file_on_drive — wait_for_file_on_drive • earthEngineGrabR
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
92 |
93 |
94 |
95 |
100 |
101 |
102 |
103 |
wait_for_file_on_drive
104 |
105 |
106 |
107 |
wait_for_file_on_drive(filename, verbose = T)
108 |
109 |
Arguments
110 |
111 |
112 |
113 | filename |
114 | name of the file to scan drive for |
115 |
116 |
117 |
118 |
119 |
120 |
127 |
128 |
129 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
--------------------------------------------------------------------------------
/earthEngineGrabR.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: Default
4 | SaveWorkspace: Default
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: Sweave
13 | LaTeX: pdfLaTeX
14 |
15 | BuildType: Package
16 | PackageUseDevtools: Yes
17 | PackageInstallArgs: --no-multiarch --with-keep.source
18 | PackageRoxygenize: rd,collate,namespace
19 |
--------------------------------------------------------------------------------
/earthEngineGrabR.md:
--------------------------------------------------------------------------------
1 |
2 | # The earthEngineGrabR Workflow
3 |
4 | * **Search** for dataset in Earth Engine [Data Catalog](https://developers.google.com/earth-engine/datasets/) .
5 |
6 | * **Grab** data according to a user defines data reuquest.
7 |
8 | #### Search for data
9 |
10 | Use Earth Engine's [Data Catalog](https://developers.google.com/earth-engine/datasets/) to browse and find datasets you want to grab using the earthEngineGrabR. Once you have found a dataset, use the snippet section to obtain the **dataset ID** and whether the dataset is an **image** or a **collection of images**. The snippet section consists of one line of code (don't open the link) and shows how Earth Engine loads the dataset. If it is an image, the `ee.Image(dataset-ID)` constructor is used. if it is a collection the `ee.ImageCollection(dataset-id)` constructor is used instead.
11 |
12 | #### Grab data
13 |
14 | `ee_grab()` requests and imports data from Earth Engine to R. `ee_grab()` takes two arguments, `data` and `targetArea`. `data` takes a single or a list of `ee_data_image()` and `ee_data_collection()` functions, which define the requested data to `ee_grab()`. If the requested data is an image use `ee_data_image()`, if it's a collection use `ee_data_collection()`. `targetArea` takes a path to a local geo-file, which defines the spatial target in which the data sould be aggregated.
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/inst/Python/access_id.py:
--------------------------------------------------------------------------------
1 |
2 | import webbrowser
3 | import urllib
4 | import urllib2
5 | import gdal
6 |
7 | client_id = "313069417367-efu6s6pldp8pbf86il3grjdv8kpgp5d4.apps.googleusercontent.com"
8 | client_secret = "9sKMt27c8uQprUja2y5Mk4o_"
9 | ft_scope = "https://www.googleapis.com/auth/fusiontables"
10 | authorize = "https://accounts.google.com/o/oauth2/auth"
11 | access = "https://accounts.google.com/o/oauth2/token"
12 | # redirect_uri = "urn:ietf:wg:oauth:2.0:oob"
13 | # redirect_uri = "http://localhost"
14 | redirect_uri = "http://localhost:1410/"
15 |
16 | #ft_auth_url = gdal.GOA2GetAuthorizationURL(ft_scope)
17 | #print(ft_auth_url)
18 |
19 | # webbrowser.open("https://accounts.google.com/o/oauth2/auth", "response_type=code")
20 |
21 | authorisation_url = 'https://accounts.google.com/o/oauth2/auth?' + urllib.urlencode({
22 | 'client_id': client_id,
23 | 'scope': ft_scope,
24 | 'redirect_uri': redirect_uri,
25 | 'response_type': 'code',
26 | })
27 |
28 |
29 | webbrowser.open_new(authorisation_url)
30 |
31 | auth_code = raw_input('Enter code here: ')
32 |
33 | #auth_code = "4/VgAQUn_aLn6xsTTyhQB7iDF7e4zjM7AonRXjw58lqL4Z8qpHR4uOT0A"
34 |
35 | data = urllib.urlencode({
36 | 'code': auth_code,
37 | 'client_id': client_id,
38 | 'client_secret': client_secret,
39 | 'redirect_uri': redirect_uri,
40 | 'grant_type': 'authorization_code'
41 | })
42 |
43 | request = urllib2.Request(
44 | url='https://accounts.google.com/o/oauth2/token',
45 | data=data)
46 |
47 | request_open = urllib2.urlopen(request)
48 | pirnt(request_open)
49 |
50 |
51 |
52 | #def get_ft_auth_tokens:
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | #import json
62 | #import os
63 | #from osgeo import ogr
64 | #from osgeo import gdal
65 |
66 |
67 | #config_path = os.path.expanduser('~/.config/earthengine/ft_credentials.json')
68 | #refresh_token = json.load(open(config_path))['refresh_token']
69 | #ft_driver = ogr.GetDriverByName('GFT')
70 | #dst_ds = ft_driver.Open('GFT:refresh=' + refresh_token, True)
71 | #dst_layer = dst_ds.GetLayerByName("mike_bnd_af")
72 | #print(dst_layer.GetStyleTable())
73 |
74 |
--------------------------------------------------------------------------------
/inst/Python/dev_functions.py:
--------------------------------------------------------------------------------
1 | import ee
2 |
3 |
4 | # productID = "JAXA/GPM_L3/GSMaP/v6/operational"
5 | # productID = 'CGIAR/SRTM90_V4'
6 | productID = "MODIS/051/MOD44B"
7 |
8 |
9 |
10 |
11 | def get_info(productID):
12 | ee.Initialize()
13 |
14 | info_output = {}
15 |
16 | try:
17 | product = ee.Image(productID)
18 | info = product.getInfo()
19 |
20 | info_output['data_type'] = info['type']
21 | info_output['bands'] = product.bandNames().getInfo()
22 | info_output['epsg'] = info['bands'][0]['crs']
23 |
24 | except Exception:
25 | pass
26 | try:
27 | product_all = ee.ImageCollection(productID)
28 | product_single = ee.Image(product_all.first())
29 | info = product_single.getInfo()
30 |
31 | last = ee.Image(product_all.sort("system:time_start", False).first())
32 | first = ee.Image(product_all.sort("system:time_start").first())
33 |
34 | date_first = ee.Date(first.get('system:time_start')).format("Y-M-d").getInfo()
35 | date_last = ee.Date(last.get('system:time_start')).format("Y-M-d").getInfo()
36 |
37 | info_output['range'] = [date_first, date_last]
38 |
39 | info_output['size'] = product_all.size().getInfo()
40 | info_output['data_type'] = 'ImageCollection'
41 | info_output['bands'] = product_single.bandNames().getInfo()
42 | info_output['epsg'] = info['bands'][0]['crs']
43 |
44 |
45 | except Exception:
46 | raise IOError('With the given ID no data set was found')
47 |
48 | return info_output
49 |
50 |
51 | info = get_info("LANDSAT/LC08/C01/T1_SR")
52 |
53 |
54 | #print(data_type)
55 | #print(info['bands'])
56 |
57 | for key, value in info.items():
58 | print('the {} of the dataset are {}'.format(key, value))
59 |
60 | #info_clean = json.loads(info)
61 | # print(info_clean)
62 |
63 |
64 |
--------------------------------------------------------------------------------
/inst/Python/ee_authorisation_function.py:
--------------------------------------------------------------------------------
1 | import ee
2 | from ee.cli import commands
3 | import webbrowser
4 | import urllib
5 | from ee.oauth import get_credentials_path
6 | import json
7 |
8 | ft_scope = 'https://www.googleapis.com/auth/fusiontables'
9 |
10 |
11 | def request_ee_code():
12 | # get authorisation url
13 | auth_url = ee.oauth.get_authorization_url()
14 | # call auth_url in browser to grand access by the user
15 | webbrowser.open_new(auth_url)
16 |
17 | def request_ee_token(auth_code):
18 | token = ee.oauth.request_token(auth_code)
19 | ee.oauth.write_token(token)
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/inst/Python/get_info.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | def get_info(productID):
4 | ee.Initialize()
5 |
6 | info_output = {}
7 |
8 | try:
9 | product = ee.Image(productID)
10 | info = product.getInfo()
11 |
12 | info_output['data_type'] = info['type']
13 | info_output['bands'] = product.bandNames().getInfo()
14 | info_output['epsg'] = info['bands'][0]['crs']
15 |
16 | except Exception:
17 | pass
18 | try:
19 | product_all = ee.ImageCollection(productID)
20 | product_single = ee.Image(product_all.first())
21 | info = product_single.getInfo()
22 |
23 | last = ee.Image(product_all.sort("system:time_start", False).first())
24 | first = ee.Image(product_all.sort("system:time_start").first())
25 |
26 | date_first = ee.Date(first.get('system:time_start')).format("Y-M-d").getInfo()
27 | date_last = ee.Date(last.get('system:time_start')).format("Y-M-d").getInfo()
28 |
29 | info_output['range'] = [date_first, date_last]
30 |
31 | info_output['size'] = product_all.size().getInfo()
32 | info_output['data_type'] = 'ImageCollection'
33 | info_output['bands'] = product_single.bandNames().getInfo()
34 | info_output['epsg'] = info['bands'][0]['crs']
35 |
36 |
37 | except Exception:
38 | raise IOError('With the given ID no data set was found')
39 |
40 | return info_output
41 |
--------------------------------------------------------------------------------
/inst/Python/get_info_test.py:
--------------------------------------------------------------------------------
1 | import ee
2 |
3 | # ee.Initialize()
4 |
5 | #info_output = {}
6 |
7 | productID = "CIESIN/GPWv4/ancillary-data-grid"
8 |
9 | # print(len(info_output))
10 |
11 | # if info_output:
12 | # print(len(info_output))
13 |
14 |
15 | def get_info(productID):
16 |
17 | ee.Initialize()
18 |
19 | info_output = {}
20 |
21 | try:
22 | product = ee.Image(productID)
23 | info = product.getInfo()
24 |
25 | info_output['data_type'] = info['type']
26 | info_output['bands'] = product.bandNames().getInfo()
27 | info_output['epsg'] = info['bands'][0]['crs']
28 | info_output['tile'] = product.get('title').getInfo()
29 |
30 | except Exception:
31 | pass
32 | try:
33 | product_all = ee.ImageCollection(productID)
34 | product_single = ee.Image(product_all.first())
35 | info = product_single.getInfo()
36 |
37 | last = ee.Image(product_all.sort("system:time_start", False).first())
38 | first = ee.Image(product_all.sort("system:time_start").first())
39 |
40 | date_first = ee.Date(first.get('system:time_start')).format("Y-M-d").getInfo()
41 | date_last = ee.Date(last.get('system:time_start')).format("Y-M-d").getInfo()
42 |
43 | info_output['range'] = [date_first, date_last]
44 |
45 | info_output['number_of_images'] = product_all.size().getInfo()
46 | info_output['data_type'] = 'ImageCollection'
47 | info_output['bands'] = product_single.bandNames().getInfo()
48 | info_output['epsg'] = info['bands'][0]['crs']
49 | info_output['tile'] = product_all.get('title').getInfo()
50 |
51 | except Exception:
52 | pass
53 |
54 | if len(info_output) == 0:
55 | raise IOError('With the given ID no data set was found')
56 |
57 | return info_output
58 |
59 |
60 | info = get_info(productID)
61 |
62 | print(info)
63 |
--------------------------------------------------------------------------------
/inst/Python/test-errors.py:
--------------------------------------------------------------------------------
1 |
2 | import ee
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | spatial_reducer = "mean"
12 | names = ["landcover", "quality"]
13 |
14 | new_names = [n + "_" + spatial_reducer for n in names]
15 | print(new_names)
--------------------------------------------------------------------------------
/inst/Python/test_get_data.py:
--------------------------------------------------------------------------------
1 | import ee
2 | #from ee_get_data import get_info
3 |
4 | ee.Initialize()
5 | data = ee.Image("CGIAR/SRTM90_V4")
6 | print(data.getInfo())
7 |
8 | #info = get_info("MODIS/006/MOD08_M3")
9 |
10 | #print(info['data_type'])
11 | #print(info)
12 | # productID = "MODIS/006/MOD08_M3"
13 | #productID = "CGIAR/SRTM90_V4"
14 |
15 | #ee.Initialize()
16 |
17 | # product_all = ee.ImageCollection(productID)
18 | #product_single = ee.Image(productID)
19 |
20 | #product_single = ee.Image(product_all.first())
21 | # title = product_all.get('title').getInfo()
22 | #title = product_single.get('title').getInfo()
23 |
24 | #info = product_single.getInfo()
25 | #print(info['properties'])
26 |
27 | #print(info.keys())
28 | #print(info['id'])
29 | #print(info['properties'])
30 | #print(info['version'])
31 | #print(info['type'])
32 | #print(info['bands'])
33 | #print(title)
34 |
35 |
36 |
--------------------------------------------------------------------------------
/inst/Python/tests.py:
--------------------------------------------------------------------------------
1 |
2 | import ee
3 |
4 |
5 |
6 | print 'Visit the URL below in a browser to authorize'
7 | print '%s?client_id=%s&redirect_uri=%s&scope=%s&response_type=code' % \
8 | ('https://accounts.google.com/o/oauth2/auth',
9 | client_id,
10 | redirect_uri,
11 | 'https://www.googleapis.com/auth/fusiontables')
12 |
13 | #4. Google redirects the user back to your web application and
14 | # returns an authorization code
15 | auth_code = raw_input('Enter authorization code (parameter of URL): ')
16 |
17 | #5. Your application requests an access token and refresh token from Google
18 | data = urllib.urlencode({
19 | 'code': auth_code,
20 | 'client_id': client_id,
21 | 'client_secret': client_secret,
22 | 'redirect_uri': redirect_uri,
23 | 'grant_type': 'authorization_code'
24 | })
25 |
26 |
27 | request = urllib2.Request(
28 | url='https://accounts.google.com/o/oauth2/token',
29 | data=data)
30 | request_open = urllib2.urlopen(request)
31 |
32 | #6. Google returns access token, refresh token, and expiration of
33 | # access token
34 | response = request_open.read()
35 |
--------------------------------------------------------------------------------
/man/ee_data_collection.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/ee_products.R
3 | \name{ee_data_collection}
4 | \alias{ee_data_collection}
5 | \title{Defines request for collection data}
6 | \usage{
7 | ee_data_collection(datasetID = "UCSB-CHG/CHIRPS/DAILY",
8 | spatialReducer = "mean", temporalReducer = "mean",
9 | timeStart = "2017-01-01", timeEnd = "2017-02-01",
10 | resolution = NULL, bandSelection = NULL)
11 | }
12 | \arguments{
13 | \item{datasetID}{\code{string} that specifies the dataset in Earth Engine. The dataset ID can be found in the \href{link to tutorial }{snippet section} of the dataset in the Earth Engine \href{https://developers.google.com/earth-engine/datasets/}{Data Catalog}.}
14 |
15 | \item{spatialReducer}{\code{string} that specifies the spatial aggregation of the data within the polygons of the targetArea. The spatial reducer can be one of \code{"mean", "median", "min", "max", "mode"}}
16 |
17 | \item{temporalReducer}{\code{string} that specifies the temporal aggregation of the filtered image collection. The spatial reducer can be one of \code{"mean", "median", "min", "max", "mode", "sum"}}
18 |
19 | \item{timeStart}{\code{string} with the date format of yyyy-mm-dd, to filter the image collection.}
20 |
21 | \item{timeEnd}{\code{string} with the date format of yyyy-mm-dd, to filter the image collection. The date selection is inclusive for the dateStart date and exclusive for the timeEnd date. Therefore, to select a single day use the date of the day as time start and the day after as timeEnd date.}
22 |
23 | \item{resolution}{\code{integer} that controls the \href{https://developers.google.com/earth-engine/scale}{scale of analysis} in Earth Engine. The resolution controls the resolution of the data in which the computations are performed. In Earth Engine data is ingested at multiple resolutions, in an image pyramid. When you use an image, Earth Engine chooses a level of the pyramid with the closest resolution less than or equal to the resolution specified by your resolution argument and resamples (using nearest neighbour by default) as necessary. If resolution is left to NULL, the native resolution of the data is used.}
24 |
25 | \item{bandSelection}{\code{string} or a \code{vector} of \code{strings} of bands names to select from the requested dataset. By default bandSelection is set to \code{NULL} and all bands of the dataset are used.}
26 | }
27 | \value{
28 | object of class \code{list} that defines request for collection data in \code{ee_grab()}.
29 | }
30 | \description{
31 | \code{ee_data_image()} and \code{ee_data_collection()} are used to define the requested earth enigne data for the \code{ee_grab()} function.
32 | }
33 | \section{Image and Image Collections in Earth Engine}{
34 |
35 |
36 | In Earth Engine raster data is stored as an \code{Image} object.
37 | Images are composed of one or more bands and each band has its own name, data type, resolution, mask and projection. A time series or stack of Images is stored as an Image Collection.
38 | To request data from an Image use \code{ee_data_image()} to define the request.
39 | To request data from a time series of Images stored in an Image Collection use \code{ee_data_collection()} instead.
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/man/ee_data_image.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/ee_products.R
3 | \name{ee_data_image}
4 | \alias{ee_data_image}
5 | \title{Defines request for image data}
6 | \usage{
7 | ee_data_image(datasetID = "CGIAR/SRTM90_V4", spatialReducer = "mean",
8 | resolution = NULL, bandSelection = NULL)
9 | }
10 | \arguments{
11 | \item{datasetID}{\code{string} that specifies the dataset in Earth Engine. The dataset ID can be found in the \href{link to tutorial }{snippet section} of the dataset in the Earth Engine \href{https://developers.google.com/earth-engine/datasets/}{Data Catalog}.}
12 |
13 | \item{spatialReducer}{\code{string} that specifies the spatial aggregation of the data within the polygons of the targetArea. The spatial reducer can be one of \code{"mean", "median", "min", "max", "mode"}}
14 |
15 | \item{resolution}{\code{integer} that controls the \href{https://developers.google.com/earth-engine/scale}{scale of analysis} in Earth Engine. The resolution controls the resolution of the data in which the computations are performed. In Earth Engine data is ingested at multiple resolutions, in an image pyramid. When you use an image, Earth Engine chooses a level of the pyramid with the closest resolution less than or equal to the resolution specified by your resolution argument and resamples (using nearest neighbour by default) as necessary. If resolution is left to NULL, the native resolution of the data is used.}
16 |
17 | \item{bandSelection}{\code{string} or a \code{vector} of \code{strings} of bands names to select from the requested dataset. By default bandSelection is set to \code{NULL} and all bands of the dataset are used.}
18 | }
19 | \value{
20 | object of class \code{list} that defines the data request for \code{ee_grab()}.
21 | }
22 | \description{
23 | \code{ee_data_image()} and \code{ee_data_collection()} are used to define the requested earth enigne data for the \code{ee_grab()} function.
24 | }
25 | \section{Image and Image Collections in Earth Engine}{
26 |
27 |
28 | In Earth Engine raster data is stored as an \code{Image} object.
29 | Images are composed of one or more bands and each band has its own name, data type, resolution, mask and projection. A time series or stack of Images is stored as an Image Collection.
30 | To request data from an Image use \code{ee_data_image()} to define the request.
31 | To request data from a time series of Images stored in an Image Collection use \code{ee_data_collection()} instead.
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/man/ee_grab.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/ee_grab.R
3 | \name{ee_grab}
4 | \alias{ee_grab}
5 | \title{Request and import data from Earth Engine}
6 | \usage{
7 | ee_grab(data = NULL, targetArea = NULL, verbose = T,
8 | testCase = NULL)
9 | }
10 | \arguments{
11 | \item{data}{\code{list} of \code{ee_data_image()} or \code{ee_data_collection()} functions which define the requested data. Multiple functions are passed inside a \code{list}, while a single function can be passed directly.}
12 |
13 | \item{targetArea}{\code{character} path to a local geo-file that should be used as a targetArea (.shp, .geojson, .kml). If the file is already uploaded, the upload is skipped.}
14 |
15 | \item{verbose}{\code{logical}, whether to inform the user about the processing state of the data. Default is set to \code{True}.}
16 |
17 | \item{testCase}{\code{character}, simulates user input. For development only. Default is set to \code{NULL}.}
18 | }
19 | \value{
20 | Object of class \code{sf}. \code{ee_grab()} returns the targetArea file with the bands of the requested data added as columns.
21 | }
22 | \description{
23 | The \code{ee_grab()} function Request and imports data from Earth Engine according to a user defined data request.
24 | }
25 | \details{
26 | To define the data request:
27 |
28 | use \code{ee_data_image()} and \code{ee_data_collection()} to define the data.
29 |
30 | use \code{targetArea} to define the spatial target, in which the data sould be aggregated.
31 | }
32 | \section{\code{earthEngineGrabR} Workflow}{
33 |
34 |
35 | Search for dataset in Earth Engine \href{https://developers.google.com/earth-engine/datasets/}{Data Catalog}.
36 |
37 | Grab data according to a user defines data reuquest.
38 | }
39 |
40 | \section{Search for data}{
41 |
42 | Use Earth Engine's \href{https://developers.google.com/earth-engine/datasets/}{Data Catalog} to browse and find datasets you want to grab using the earthEngineGrabR. Once you have found a dataset, use the \href{link to tutorial }{snippet section} to obtain the dataset ID and whether the dataset is an image or a collection of images. The snippet section consists of one line of code (don't open the link) and shows how Earth Engine loads the dataset. If it is an image, the ee.Image(dataset-ID) constructor is used. if it is a collection the ee.ImageCollection(dataset-id) constructor is used instead.
43 | }
44 |
45 | \section{Grab data}{
46 |
47 |
48 | \code{ee_grab()} requests and imports data from Earth Engine to R.
49 | \code{ee_grab()} takes two arguments, \code{data} and \code{targetArea}.
50 | \code{data} takes a single or a \code{list} of \code{ee_data_image()} and \code{ee_data_collection()} functions, which define the requested data to \code{ee_grab()}.
51 | If the requested data is an image use \code{ee_data_image()}, if it's a collection use \code{ee_data_collection()}.
52 | \code{targetAreo} takes a path to a local geo-file, which defines the spatial target in which the data sould be aggregated.
53 | }
54 |
55 | \section{Internal processing}{
56 |
57 |
58 | The \code{ee_grab()} processing runs in 4 steps:
59 |
60 | 1. Upload - The targetArea is uploaded to Google Drive.
61 |
62 | 2. Request - The data is requested from Google Earth Engine and exported to Google Drive.
63 |
64 | 3. Download - The data is downloaded from Drive.
65 |
66 | 4. Import - The data is imported to R and merged.
67 | }
68 |
69 | \examples{
70 | \dontrun{
71 | # Request a srtm image data product to get topographic data.
72 | # Grab the spatial mean of the elevation band in the polygons of your targetArea. The calculation are based on a 100 meter scale, which means that the original SRTM data product is resampled to 100 * 100 meter Pixel size.
73 |
74 | srtm_data <- ee_grab(data = ee_data_image(datasetID = "CGIAR/SRTM90_V4",
75 | spatialReducer = "mean",
76 | resolution = 100,
77 | bandSelection = "elevation"
78 | ),
79 | targetArea = system.file("data/territories.shp", package = "earthEngineGrabR")
80 | )
81 |
82 | # Request a chirps collection data product to get precipitation data.
83 | # Grab the yearly precipitation sum for 2016 and get the spatial mean in the polygons of your targetArea.
84 |
85 | chirps_data <- ee_grab(data = ee_data_collection(datasetID = "UCSB-CHG/CHIRPS/DAILY",
86 | spatialReducer = "mean",
87 | temporalReducer = "sum",
88 | timeStart = "2016-01-01",
89 | timeEnd = "2016-12-31",
90 | resolution = 200
91 | ),
92 | targetArea = system.file("data/territories.shp", package = "earthEngineGrabR")
93 | )
94 |
95 |
96 | }
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/man/ee_grab_install.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/ee_grab_install.R
3 | \name{ee_grab_install}
4 | \alias{ee_grab_install}
5 | \title{Install dependencies and run authentications}
6 | \usage{
7 | ee_grab_install(clean_credentials = T, clean_environment = F)
8 | }
9 | \arguments{
10 | \item{clean_credentials}{\code{logical}, if \code{True} already present credential are deleted recreated by a reauthenticate. Default is set to \code{True}.}
11 |
12 | \item{clean_environment}{\code{logical}, if \code{True} already installed environments are deleted to be reinstalled again. Default is set to \code{False}.}
13 | }
14 | \description{
15 | \code{ee_grab_install()} installs the required dependencies and guides the user through the authentication processes to activate the different API's.
16 | }
17 | \section{Installation of Dependencies}{
18 |
19 |
20 | To encapsulate the dependencies from the user's system and simplify the installation, the \code{earthEngineGrabR} uses a conda environment.
21 | By running \code{ee_grab_install()} first a conda environemt "earthEngineGrabR" is created.
22 | All Further all dependencies are installed inside the "earthEngineGrabR" environment.
23 | }
24 |
25 | \section{Authentication of API's}{
26 |
27 |
28 | The earthEngineGrabR connects to 3 Google API's:
29 |
30 | \href{https://www.gdal.org/drv_gft.html}{Google Fusion Table} API for uploading data.
31 |
32 | \href{https://developers.google.com/earth-engine/}{Google Earth Engine} API for data aquisition and processing.
33 |
34 | \href{https://github.com/tidyverse/googledrive}{Google Drive} API for data download.
35 |
36 | To authenticate to the API's the user has to log in with his google account and allow the API to access data on googles servers on the user's behalf.
37 | To simplify this procedure the ee_grab_install function successively opens a browser window to log into the Google account.
38 | If the Google account is verified and the permission is granted, the user is directed to an authentification token. This token is manually copied and pasted into the R console, which creates persistent credentials.
39 | This process is repeated for each API. If the function runs successfully, all needed credentials are stored for further sessions and there should be no need for further authentification.
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/man/request_data.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/request_data.R
3 | \name{request_data}
4 | \alias{request_data}
5 | \title{request_data}
6 | \usage{
7 | request_data(product_info, target_id, verbose = T, test = F)
8 | }
9 | \arguments{
10 | \item{product_info}{list object created by ee_product functions}
11 |
12 | \item{target_id}{String of fusion table id created by upload_data()}
13 | }
14 | \value{
15 | ee_responses for each correctly exported data product
16 | }
17 | \description{
18 | Starts processing on earth engine retrieves info from data product
19 | }
20 |
--------------------------------------------------------------------------------
/man/sticker/ee sticker_cropped.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/man/sticker/ee sticker_cropped.jpg
--------------------------------------------------------------------------------
/tests/testthat.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 | library(earthEngineGrabR)
3 | test_check("earthEngineGrabR")
4 |
--------------------------------------------------------------------------------
/tests/testthat/setup-test.R:
--------------------------------------------------------------------------------
1 |
2 | # Sys.setenv("NOT_CRAN" = "false")
3 | # if (!identical(Sys.getenv("NOT_CRAN"), "false")) {
4 |
5 | context("Set up test environment")
6 |
7 | activate_environments()
8 | googledrive::drive_rm("earthEngineGrabR-tmp", verbose = F)
9 |
10 | # test_that("activate test environment",{
11 | # skip_on_cran()
12 | # # skip_if_not_installed("sf")
13 | # })
14 |
15 | #test_that("Test that required credentials exist", {
16 | credentials_test <- try(earthEngineGrabR:::test_credentials(), silent = T)
17 | expect_true(credentials_test)
18 | #})
19 |
20 |
21 | #test_that("Test that required python modules can be loaded", {
22 | #skip_on_cran()
23 | earthEngineGrabR:::activate_environments()
24 |
25 | module_test_ee <- py_module_available("ee")
26 | expect_true(module_test_ee)
27 |
28 | #})
29 |
30 | #test_that("Test that required testing files on google drive exist", {
31 | #skip_on_cran()
32 | #earthEngineGrabR:::activate_environments()
33 |
34 | # if test-download data not on google drive upload it.
35 | try(earthEngineGrabR:::gd_auth(), silent = T)
36 | test <- googledrive::drive_find("CGIAR-SRTM90_V4_s-mean.geojson", verbose = F)
37 | environment_test <- try(nrow(test) > 0, silent = T)
38 | if (!environment_test) stop(paste("Testing is not possible. \n", "files on google drive: ", environment_test))
39 | #})
40 |
41 |
42 |
43 | #test_that("upload files", {
44 | #skip_on_cran()
45 | #earthEngineGrabR:::activate_environments()
46 |
47 | # build environment
48 | # remove upload files if still present
49 | #googledrive::drive_rm("test-upload", verbose = F)
50 |
51 | # upload test data for download test
52 |
53 |
54 | # if tmp dir exists delete it
55 | #})
56 |
57 |
58 | #}
59 |
--------------------------------------------------------------------------------
/tests/testthat/teardown-test-environment.R:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # delete uploaded file
5 | test_that("delete tmp files", {
6 | skip_test_if_not_possible()
7 | #try(googledrive::drive_rm("test-upload", verbose = F), silent = T)
8 |
9 | temp_path <- get_temp_path(F)
10 | if (dir.exists(temp_path))
11 | unlink(temp_path, recursive = T)
12 | })
13 |
14 |
--------------------------------------------------------------------------------
/tests/testthat/test-OAuth.R:
--------------------------------------------------------------------------------
1 | library(earthEngineGrabR)
2 | context("OAuth functionality")
3 |
4 |
5 | # run_ee_oauth and run_ft_oauth cause errors during test run cause of readline function that canot be evalueted without a evaluation stop.
6 |
7 | test_that("test that test_credentials work as expacted", {
8 | skip_test_if_not_possible()
9 | # expect true if all credentials exists
10 | credentials_test <- test_credentials()
11 | expect_true(credentials_test)
12 | # expect true if one exists
13 | credentials_test <- test_credentials(credentials = "credentials")
14 | expect_true(credentials_test)
15 | # expect error if with_error argument true and name not exists
16 | expect_error(test_credentials(
17 | credentials = "test",
18 | with_error = T,
19 | silent_match = T
20 | ))
21 | })
22 |
23 |
24 | test_that("test that activate_environment behaves like expacted", {
25 | skip_test_if_not_possible()
26 | expect_error(earthEngineGrabR:::activate_environments("wrong_name"))
27 |
28 | })
29 |
30 | test_that("test that get_credentials_root behaves like expected", {
31 | skip_test_if_not_possible()
32 |
33 | path <- get_credential_root()
34 | expect_true(dir.exists(path))
35 |
36 | })
37 |
--------------------------------------------------------------------------------
/tests/testthat/test-download.R:
--------------------------------------------------------------------------------
1 | library(earthEngineGrabR)
2 |
3 | context("Download functionalities")
4 |
5 | #if (!identical(Sys.getenv("NOT_CRAN"), "false")) {
6 |
7 | # try(earthEngineGrabR:::gd_auth(), silent = T)
8 | # test <- googledrive::drive_find("CGIAR-SRTM90_V4_s-mean.geojson", verbose = F)
9 | # environment_test <- try(nrow(test) > 0, silent = T)
10 | # if (!environment_test) stop(paste("Testing is not possible. \n", "files on google drive: ", environment_test))
11 | #
12 |
13 | test_file <- "CGIAR-SRTM90_V4_s-mean.geojson"
14 | # test_file <- "test_SRTM.geojson"
15 | temp_dir <- get_temp_path(F)
16 |
17 | # }
18 | # googledrive::drive_download("test_SRTM.geojson", path = file.path(test_dir, "test_SRTM.geojson"), overwrite = T)
19 |
20 |
21 | test_that("Test that download_data downloads test file from google drive", {
22 | skip_test_if_not_possible()
23 | earthEngineGrabR:::activate_environments()
24 |
25 | # googledrive::drive_find(test_file, verbose = F)
26 |
27 | earthEngineGrabR:::download_data(test_file,
28 | clear = F,
29 | temp_path = temp_dir
30 | )
31 |
32 | test <- grep(test_file, list.files(temp_dir))
33 | expect_is(test, "integer")
34 | # unlink(test_dir, recursive = T)
35 | })
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | #
45 | #
46 | # list.files(test_dir)
47 | # unlink(test_dir, T)
48 | #
49 |
--------------------------------------------------------------------------------
/tests/testthat/test-ee_product.R:
--------------------------------------------------------------------------------
1 | library(earthEngineGrabR)
2 | context("Test ee_data_image and ee_data_collection")
3 |
4 |
5 | test_that(
6 | "Test that ee_data_image and ee_data_collection return correct output if input is valid",
7 | {
8 | # skip_test_if_not_possible()
9 |
10 | output_image <-
11 | ee_data_image(
12 | datasetID = "Test_xyz",
13 | spatialReducer = "mean",
14 | resolution = 200
15 | )
16 | expect_named(
17 | output_image,
18 | c(
19 | "datasetID",
20 | "productName",
21 | "spatialReducer",
22 | "resolution",
23 | "productNameFull",
24 | "data_type",
25 | "outputFormat",
26 | "bandSelection"
27 | )
28 | )
29 |
30 | output_collection <-
31 | ee_data_collection(
32 | datasetID = "Test_xyz",
33 | spatialReducer = "mean",
34 | resolution = 200,
35 | temporalReducer = "sum",
36 | timeStart = "12-02-01",
37 | timeEnd = "12-03-31"
38 | )
39 | expect_named(
40 | output_collection,
41 | c(
42 | "datasetID",
43 | "productName",
44 | "spatialReducer",
45 | "resolution",
46 | "productNameFull",
47 | "data_type",
48 | "outputFormat",
49 | "temporalReducer",
50 | "timeStart",
51 | "timeEnd",
52 | "bandSelection"
53 | ),
54 | ignore.order = T
55 | )
56 |
57 | output_collection_1 <-
58 | ee_data_collection(timeStart = "12-02-01", timeEnd = "12-03-31")
59 | output_collection_2 <-
60 | ee_data_collection(timeStart = "12-2-1", timeEnd = "12-3-31")
61 | expect_true(identical(output_collection_1, output_collection_2))
62 | }
63 | )
64 |
65 |
66 | test_that(
67 | "Test that ee_data_image and ee_data_collection raise appropriate errors if input is not valid",
68 | {
69 | # skip_test_if_not_possible()
70 |
71 | expect_error(ee_data_image(datasetID = "Test_xyz", spatialReducer = "wrong"))
72 | expect_error(ee_data_image(datasetID = NULL))
73 | expect_error(ee_data_image(datasetID = 2345))
74 | expect_error(ee_data_image(resolution = "wrong"))
75 | expect_silent(ee_data_image(resolution = NULL))
76 | expect_error(ee_data_image(bandSelection = list("string", 1)))
77 | expect_error(ee_data_image(bandSelection = 1))
78 | expect_error(ee_data_image(bandSelection = c(1, 4)))
79 | expect_error(ee_data_collection(datasetID = "Test_xyz", spatialReducer = "wrong"))
80 | expect_error(ee_data_collection(datasetID = NULL))
81 | expect_error(ee_data_collection(datasetID = 2345))
82 | expect_error(ee_data_collection(resolution = "wrong"))
83 | expect_silent(ee_data_collection(resolution = NULL))
84 | expect_error(ee_data_collection(spatialReducer = "sum"))
85 | expect_error(ee_data_collection(timeStart = 1234))
86 | expect_error(ee_data_collection(timeEnd = as.Date(1234)))
87 | expect_error(ee_data_collection(timeStart = "12/02/01", timeEnd = "12/03/31"))
88 | expect_error(ee_data_collection(timeStart = "2015-01-01", timeEnd = "2015-01-01"))
89 | expect_error(ee_data_collection(timeEnd = "dfg-ff-12"))
90 | expect_error(ee_data_collection(bandSelection = list("string", 1)))
91 | expect_error(ee_data_collection(bandSelection = 1))
92 | expect_error(ee_data_collection(bandSelection = c(T, F)))
93 | }
94 | )
95 |
--------------------------------------------------------------------------------
/tests/testthat/test-install.R:
--------------------------------------------------------------------------------
1 | library(earthEngineGrabR)
2 |
3 | context("Installation and Environment tests")
4 |
5 | test_that("Test that ee_grab_install passes without installation, if specified and dependencies allready installed", {
6 | # cannot open connection error while testing ?
7 |
8 | skip_test_if_not_possible()
9 | activate_environments()
10 | expect_output(ee_grab_install(clean_credentials = F, clean_environment = F))
11 |
12 | })
13 |
--------------------------------------------------------------------------------
/tests/testthat/test-request_data.R:
--------------------------------------------------------------------------------
1 | library(earthEngineGrabR)
2 |
3 | context("Test EE request functionality")
4 | #if (!identical(Sys.getenv("NOT_CRAN"), "false")) {
5 | targetArea <- "users/JesJehle/eeg_min_test"
6 |
7 | activate_environments()
8 | #}
9 |
10 | test_that(
11 | "test that get_data processes data on earth engine and exports it to drive while returning status of process",
12 | {
13 | skip_test_if_not_possible()
14 |
15 | df <- ee_data_image(
16 | datasetID = "CGIAR/SRTM90_V4",
17 | spatialReducer = "min",
18 | resolution = 3000,
19 | bandSelection = NULL
20 | )
21 |
22 | df$ftID <- targetArea
23 | earthEngineGrabR:::delete_on_drive(df$productNameFull)
24 |
25 | status <- earthEngineGrabR:::get_data(df)
26 | expect_named(
27 | status,
28 | c(
29 | "creation_timestamp_ms",
30 | "start_timestamp_ms",
31 | "name",
32 | "state",
33 | "task_type",
34 | "description",
35 | "id",
36 | "update_timestamp_ms"
37 | ),
38 | ignore.order = TRUE
39 | )
40 | test <-
41 | earthEngineGrabR:::wait_for_file_on_drive(df$productNameFull, verbose = F)
42 | expect_true(test)
43 | }
44 | )
45 |
46 |
47 | test_that("test that bug: OverflowError: Python int too large to convert to C long, is fixed",
48 | {
49 | skip_test_if_not_possible()
50 |
51 | df <- ee_data_image(
52 | datasetID = "CGIAR/SRTM90_V4",
53 | spatialReducer = "max",
54 | resolution = 3000,
55 | bandSelection = NULL
56 | )
57 |
58 | target_id <- targetArea
59 |
60 | status <- earthEngineGrabR:::request_data(df, target_id)
61 | expect_is(status, "character")
62 |
63 | new_df <- df
64 | new_df$ftID <- target_id
65 |
66 | status <- earthEngineGrabR:::get_data(new_df)
67 |
68 | expect_match(status$state, "READY")
69 |
70 |
71 | })
72 |
73 |
74 |
75 |
76 |
77 | test_that("test that get_data raises a meaninfull message without crashing",
78 | {
79 | skip_test_if_not_possible()
80 |
81 |
82 | # wrong product ID
83 | df <- ee_data_image(datasetID = "CGIAR/wrong")
84 | df$ftID <- targetArea
85 |
86 | status <- get_data(df)
87 | expect_match(status, "Error")
88 | expect_match(status, "Image asset 'CGIAR/wrong' not found")
89 |
90 | # wrong product ID
91 | df <- ee_data_collection(
92 | datasetID = "UCSB-CHG/CHIRPS/DAILY",
93 | timeStart = "1950-01-01",
94 | timeEnd = "1955-01-01",
95 | spatialReducer = "mean",
96 | temporalReducer = "mean",
97 | resolution = 4000
98 | )
99 |
100 | df$ftID <- targetArea
101 |
102 | status <- get_data(df)
103 | expect_match(status, "Error")
104 | expect_match(status, "No images found with the given daterange")
105 | })
106 |
107 |
108 |
109 | test_that("test that check_processing raises error if task failed and no valid requests left",
110 | {
111 | skip_test_if_not_possible()
112 |
113 | df <- ee_data_image(
114 | datasetID = "CGIAR/SRTM90_V4",
115 | spatialReducer = "mode",
116 | resolution = 0,
117 | bandSelection = NULL
118 | )
119 |
120 | ft_id <- targetArea
121 |
122 | ee_respones <-
123 | expect_error(expect_warning(earthEngineGrabR:::request_data(df, ft_id)))
124 |
125 | })
126 |
127 |
128 | test_that("test that check_scale raises an error with Bands of different resolutions",
129 | {
130 | earthEngineGrabR:::skip_test_if_not_possible()
131 | different_res <- 'COPERNICUS/S2'
132 | expect_error(earthEngineGrabR:::check_scale(different_res))
133 | })
134 |
135 | test_that("test that check_scale returns resolutions with bands of same resolution",
136 | {
137 | earthEngineGrabR:::skip_test_if_not_possible()
138 | same_res <- 'COPERNICUS/S5P/OFFL/L3_AER_AI'
139 | res <- earthEngineGrabR:::check_scale(same_res)
140 | expect_is(res, "integer")
141 | })
142 |
143 | test_that("test that check_scale raises an error with non valid id", {
144 | earthEngineGrabR:::skip_test_if_not_possible()
145 | fail <- 'wrong_name'
146 | expect_error(earthEngineGrabR:::check_scale(fail))
147 | })
148 |
149 |
150 | #if (!identical(Sys.getenv("NOT_CRAN"), "false")) {
151 |
152 | #googledrive::drive_rm("earthEngineGrabR-tmp", verbose = F)
153 |
154 | #}
155 |
--------------------------------------------------------------------------------
/tests/testthat/test-setup.R:
--------------------------------------------------------------------------------
1 |
2 | library(earthEngineGrabR)
3 | context("Requirements for the test to run")
4 |
5 | test_that("Test that required credentials exist", {
6 | skip_test_if_not_possible()
7 | activate_environments()
8 |
9 | credentials_test <- try(test_credentials(), silent = T)
10 | expect_true(credentials_test)
11 | })
12 |
13 | test_that("Test that required python modules can be loaded", {
14 | skip_test_if_not_possible()
15 | activate_environments()
16 |
17 | test_ee <- py_module_available("ee")
18 |
19 | expect_true(test_ee)
20 | })
21 |
22 | # create temp folder for tests
23 | temp_path <- get_temp_path(T)
24 |
25 |
26 |
--------------------------------------------------------------------------------
/tests/testthat/test-tokens/credentials:
--------------------------------------------------------------------------------
1 | {"refresh_token": "1/HCpsQwMfEqRlxYj5PlJ2XmsB3bF1zaMAXfmuvuvJgUA"}
--------------------------------------------------------------------------------
/tests/testthat/test-tokens/ft_credentials.json:
--------------------------------------------------------------------------------
1 | {"refresh_token": "1/nQt5CSWXqnWXw6F-wNfbyR4AjYLCuf4_SuGv8Co83BA"}
--------------------------------------------------------------------------------
/tests/testthat/test-tokens/gd-credentials.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JesJehle/earthEngineGrabR/f37057fc57e2a18480b0fbab95cadea5fec56967/tests/testthat/test-tokens/gd-credentials.rds
--------------------------------------------------------------------------------