| Title: | Building and Managing Local Databases from 'Google Earth Engine' |
|---|---|
| Description: | Simplifies the creation, management, and updating of local databases using data extracted from 'Google Earth Engine' ('GEE'). It integrates with 'GEE' to store, aggregate, and process spatio-temporal data, leveraging 'SQLite' for efficient, serverless storage. The 'geeLite' package provides utilities for data transformation and supports real-time monitoring and analysis of geospatial features, making it suitable for researchers and practitioners in geospatial science. For details, see Kurbucz and Andrée (2025) "Building and Managing Local Databases from Google Earth Engine with the geeLite R Package" <https://hdl.handle.net/10986/43165>. |
| Authors: | Marcell T. Kurbucz [aut, cre], Bo Pieter Johannes Andrée [aut] |
| Maintainer: | Marcell T. Kurbucz <[email protected]> |
| License: | MPL-2.0 |
| Version: | 1.0.6 |
| Built: | 2026-05-11 06:33:30 UTC |
| Source: | https://github.com/cran/geeLite |
Returns a data frame containing ISO 3166-1 country codes and ISO 3166-2 subdivision codes for the specified administrative level.
fetch_regions(admin_lvl = 0)fetch_regions(admin_lvl = 0)
admin_lvl |
[optional] (integer) Administrative level to retrieve:
|
A data frame containing region names, ISO 3166-2 codes, and the corresponding administrative levels.
# Example: Fetch ISO 3166-1 country codes ## Not run: fetch_regions() ## End(Not run)# Example: Fetch ISO 3166-1 country codes ## Not run: fetch_regions() ## End(Not run)
Displays information on the available variables in the SQLite database
(data/geelite.db).
fetch_vars( path, format = c("data.frame", "markdown", "latex", "html", "pipe", "simple", "rst") )fetch_vars( path, format = c("data.frame", "markdown", "latex", "html", "pipe", "simple", "rst") )
path |
[mandatory] (character) Path to the root directory of the generated database. |
format |
[optional] (character) A character string. Possible values
are |
Returns the variable information in the selected format. If
format = "data.frame", a data.frame is returned. For other
formats, the output is printed in the specified format and NULL is
returned invisibly.
# Example: Printing the available variables ## Not run: fetch_vars(path = "path/to/db") ## End(Not run)# Example: Printing the available variables ## Not run: fetch_vars(path = "path/to/db") ## End(Not run)
Sets up a Conda environment with all required Python and R dependencies
for using the rgee package, including a specific version of the
earthengine-api. If Conda is not available, the user will be prompted
to install Miniconda. The created environment is automatically registered
for use with rgee.
gee_install(conda = "rgee", python_version = "3.11", force_recreate = FALSE)gee_install(conda = "rgee", python_version = "3.11", force_recreate = FALSE)
conda |
[optional] (character) Name of the Conda environment to create
or use. Defaults to |
python_version |
[optional] (character) Python version to use when
creating the Conda environment. Defaults to |
force_recreate |
[optional] (logical) If |
Invisibly returns the name of the Conda environment used or created.
Even after installation, users must manually accept the Conda Terms of Service (ToS) using the 'conda tos accept' command before package installation can proceed. Clear instructions will be provided if ToS acceptance is needed.
# Example: Creating a Conda environment with 'rgee' dependencies ## Not run: gee_install() ## End(Not run)# Example: Creating a Conda environment with 'rgee' dependencies ## Not run: gee_install() ## End(Not run)
Reads and prints the configuration file from the database's root directory in a human-readable format.
get_config(path)get_config(path)
path |
[mandatory] (character) The path to the root directory of the generated database. |
A character string representing the formatted JSON content of the configuration file.
# Example: Printing the configuration file ## Not run: get_config(path = "path/to/db") ## End(Not run)# Example: Printing the configuration file ## Not run: get_config(path = "path/to/db") ## End(Not run)
Reads and prints the state file from the database's root directory in a human-readable format.
get_state(path)get_state(path)
path |
[mandatory] (character) The path to the root directory of the generated database. |
A character string representing the formatted JSON content of the state file.
# Example: Printing the state file ## Not run: get_state(path = "path/to/db") ## End(Not run)# Example: Printing the state file ## Not run: get_state(path = "path/to/db") ## End(Not run)
Creates a postp folder at path and adds two files:
structure.json and functions.R.
init_postp(path, verbose = TRUE)init_postp(path, verbose = TRUE)
path |
[mandatory] |
verbose |
[optional] (logical) Display messages (default: |
The structure.json file is initialized with "default": null.
The functions.R file contains simple example functions that match the
default "do nothing" behavior plus a z-score example.
No return value, called for side effects.
# Example: Initialize post-processing files in the database directory ## Not run: init_postp("path/to/db") ## End(Not run)# Example: Initialize post-processing files in the database directory ## Not run: init_postp("path/to/db") ## End(Not run)
Modifies the configuration file located in the specified root directory of
the generated database (config/config.json) by updating values
corresponding to the specified keys.
modify_config(path, keys, new_values, verbose = TRUE)modify_config(path, keys, new_values, verbose = TRUE)
path |
[mandatory] (character) The path to the root directory of the generated database. |
keys |
[mandatory] (list) A list specifying the path to the values in the configuration file that need updating. Each path should correspond to a specific element in the configuration. |
new_values |
[mandatory] (list) A list of new values to replace the
original values at the locations specified by 'keys'. The length of
|
verbose |
[optional] (logical) If |
No return value, called for side effects.
# Example: Modifying the configuration file ## Not run: modify_config( path = "path/to/db", keys = list("limit", c("source", "MODIS/061/MOD13A2", "NDVI")), new_values = list(1000, "mean") ) ## End(Not run)# Example: Modifying the configuration file ## Not run: modify_config( path = "path/to/db", keys = list("limit", c("source", "MODIS/061/MOD13A2", "NDVI")), new_values = list(1000, "mean") ) ## End(Not run)
Reads, aggregates, and processes the SQLite database
(data/geelite.db).
read_db( path, variables = "all", freq = c("month", "day", "week", "bimonth", "quarter", "season", "halfyear", "year"), prep_fun = NULL, aggr_funs = function(x) mean(x, na.rm = TRUE), postp_funs = NULL )read_db( path, variables = "all", freq = c("month", "day", "week", "bimonth", "quarter", "season", "halfyear", "year"), prep_fun = NULL, aggr_funs = function(x) mean(x, na.rm = TRUE), postp_funs = NULL )
path |
[mandatory] (character) Path to the root directory of the generated database. |
variables |
[optional] (character or integer) Names or IDs of the
variables to be read. Use the |
freq |
[optional] (character or |
prep_fun |
[optional] (function or |
aggr_funs |
[optional] (function or list) Aggregation function(s) used
when aggregating to
|
postp_funs |
[optional] (function or list or
Default is |
# Example: Reading variables by IDs ## Not run: db_list <- read_db(path = "path/to/db", variables = c(1, 3)) ## End(Not run)# Example: Reading variables by IDs ## Not run: db_list <- read_db(path = "path/to/db", variables = c(1, 3)) ## End(Not run)
Collects and stores grid statistics from Google Earth Engine (GEE) data in
SQLite format (data/geelite.db), initializes CLI files
(cli/...), and initializes or updates the state
(state/state.json) and log (log/log.txt) files.
run_geelite( path, conda = "rgee", user = NULL, rebuild = FALSE, mode = "local", verbose = TRUE )run_geelite( path, conda = "rgee", user = NULL, rebuild = FALSE, mode = "local", verbose = TRUE )
path |
[mandatory] (character) The path to the root directory of the generated database. This must be a writable, non-temporary directory. Avoid using the home directory (~), the current working directory, or the package directory. |
conda |
[optional] (character) Name of the virtual Conda environment
used by the |
user |
[optional] (character) Specifies the Google account directory
within |
rebuild |
[optional] (logical) If |
mode |
[optional] (character) Mode of data extraction. Currently
supports |
verbose |
[optional] (logical) Display computation status and messages
(default: |
Invisibly returns NULL, called for side effects.
# Example: Build a Grid Statistics Database ## Not run: run_geelite(path = tempdir()) ## End(Not run)# Example: Build a Grid Statistics Database ## Not run: run_geelite(path = tempdir()) ## End(Not run)
Creates R scripts to enable the main functions to be called through the
Command Line Interface (CLI). These scripts are stored in the cli/
directory of the generated database.
set_cli(path, verbose = TRUE)set_cli(path, verbose = TRUE)
path |
[mandatory] (character) The path to the root directory of the generated database. This must be a writable, non-temporary directory. Avoid using the home directory (~), the current working directory, or the package directory. |
verbose |
[optional] (logical) Whether to display messages (default:
|
No return value, called for side effects.
## Not run: set_cli(path = tempdir()) ## End(Not run)## Not run: set_cli(path = tempdir()) ## End(Not run)
Creates a configuration file in the specified directory of the generated
database (config/config.json). If the specified directory does not
exist but its parent directory does, it will be created.
set_config( path, regions, source, start = "2020-01-01", resol, scale = NULL, limit = 10000, verbose = TRUE )set_config( path, regions, source, start = "2020-01-01", resol, scale = NULL, limit = 10000, verbose = TRUE )
path |
[mandatory] (character) The path to the root directory of the generated database. This must be a writable, non-temporary directory. Avoid using the home directory (~), the current working directory, or the package directory. |
regions |
[mandatory] (character) ISO 3166-1 alpha-2 country codes or ISO 3166-2 subdivision codes. |
source |
[mandatory] (list) Description of Google Earth Engine (GEE) datasets of interest (the complete data catalog of GEE is accessible at: https://developers.google.com/earth-engine/datasets/catalog). It is a nested list with three levels:
|
start |
[optional] (date) First date of the data collection
(default: |
resol |
[mandatory] (integer) Resolution of the H3 bin. |
scale |
[optional] (integer) Specifies the nominal resolution
(in meters) for image processing. If left as |
limit |
[optional] (integer) In |
verbose |
[optional] (logical) Display messages (default: |
No return value, called for side effects.
## Not run: set_config(path = tempdir(), regions = c("SO", "YM"), source = list( "MODIS/061/MOD13A1" = list( "NDVI" = c("mean", "sd") ) ), resol = 3) ## End(Not run)## Not run: set_config(path = tempdir(), regions = c("SO", "YM"), source = list( "MODIS/061/MOD13A1" = list( "NDVI" = c("mean", "sd") ) ), resol = 3) ## End(Not run)