Learn R Programming

rgee (version 0.5.0)

ee_table_to_drive: Creates a task to export a FeatureCollection to Google Drive.

Description

Creates a task to export a FeatureCollection to Google Drive. This function is a wrapper around ee$batch$Export$table$toDrive(...).

Usage

ee_table_to_drive(
  collection,
  description = "myExportTableTask",
  folder = NULL,
  fileNamePrefix = NULL,
  timePrefix = TRUE,
  fileFormat = NULL,
  selectors = NULL
)

Arguments

collection

The feature collection to be exported.

description

Human-readable name of the task.

folder

The name of a unique folder in your Drive account to export into. Defaults to the root of the drive.

fileNamePrefix

The Google Drive filename for the export. Defaults to the name of the task.

timePrefix

Add current date and time as a prefix to files to export.

fileFormat

The output format: "CSV" (default), "GeoJSON", "KML", "KMZ", "SHP", or "TFRecord".

selectors

The list of properties to include in the output, as a list of strings or a comma-separated string. By default, all properties are included. **kwargs: Holds other keyword arguments that may have been deprecated such as 'driveFolder' and 'driveFileNamePrefix'.

Value

An unstarted Task that exports the table to Google Drive.

Examples

Run this code
# NOT RUN {
library(rgee)
library(stars)
library(sf)

ee_users()
ee_reattach() # reattach ee as a reserved word
ee_Initialize(drive = TRUE)


# Define study area (local -> earth engine)
# Communal Reserve Amarakaeri - Peru
rlist <- list(xmin = -71.13, xmax = -70.95,ymin = -12.89, ymax = -12.73)
ROI <- c(rlist$xmin, rlist$ymin,
         rlist$xmax, rlist$ymin,
         rlist$xmax, rlist$ymax,
         rlist$xmin, rlist$ymax,
         rlist$xmin, rlist$ymin)
ee_ROI <- matrix(ROI, ncol = 2, byrow = TRUE) %>%
  list() %>%
  st_polygon() %>%
  st_sfc() %>%
  st_set_crs(4326) %>%
  sf_as_ee()

amk_fc <- ee$FeatureCollection(
  list(ee$Feature(ee_ROI$geometry(), list(name = "Amarakaeri")))
)

task_vector <- ee_table_to_drive(
  collection = amk_fc,
  fileFormat = "GEO_JSON",
  fileNamePrefix = "geom_Amarakaeri"
)
task_vector$start()
ee_monitoring(task_vector) # optional
ee_drive_to_local(task = task_vector)
# }

Run the code above in your browser using DataLab