Upload either images or vectors to Google Earth Engine asset

ee_upload(x, ...)

# S3 method for character
ee_upload(x, ..., filename, bucket = NULL,
  properties = getOption("rgee.upload.properties"),
  selenium_params = getOption("rgee.selenium.params"), quiet = FALSE)

# S3 method for sf
ee_upload(x, ..., filename, bucket = NULL,
  selenium_params = getOption("rgee.selenium.params"), quiet = FALSE)

# S3 method for stars
ee_upload(x, ..., filename, bucket = NULL,
  properties = getOption("rgee.upload.properties"),
  selenium_params = getOption("rgee.selenium.params"), quiet = FALSE)

# S3 method for stars_proxy
ee_upload(x, ..., filename, bucket = NULL,
  properties = getOption("rgee.upload.properties"),
  selenium_params = getOption("rgee.selenium.params"), quiet = FALSE)

Arguments

x

Character, sf or stars object to upload into a GEE asset.

...

ignored

filename

Character. Asset destination path, e.g. users/pinkiepie/myponycollection.

bucket

bucketname you are uploading to. See details.

properties

List. Set of parameters to established as a property of an EE object. See details.

selenium_params

List. Optional parameters when bucket is NULL. Parameters for setting selenium. See details.

quiet

Logical. Suppress info message.

Details

It is necessary, for uploading process, get authorization to read & write into a Google Cloud Storage (GCS) bucket. Earth Engine provides a provisional for free space into GCS through gs://earthengine-uploads/. If the bucket argument is absent, this function will use Selenium driver for getting access to the URI mentioned bellow, see ee_upload_file_to_gcs for details. Install and check the Selenium drivers for Google Chrome is possible as follow:

  • rgee::ee_install_drivers()

  • rgee::ee_check_drivers()

The properties argument is just available for image uploads, is you are interesting in setting properties in FeatureCollection. Please use ee_manage_set_properties after ee_upload.

The selenium_params argument is a three-element list consisting of:

  • gmail_account: The google account. If it is not specified, it will obtained from ee$data$getAssetRoots().

  • showpassword: Logical. After put the google account into getPass, should be shown?.

  • cache: Logical. TRUE will use the cookies saved on the /temp directory.

Examples

if (FALSE) { library(rgee) library(stars) library(sf) ee_Initialize(user_gmail = "csaybar") ee_check_drivers() filename <- "users/csaybar/rgee_upload/" ee_manage_create(filename) tif = system.file("tif/geomatrix.tif", package = "stars") geomatrix = read_stars(tif) %>% st_warp(crs=st_crs(4326)) delta_geomatrix <- c(attr(geomatrix,'dimensions')$x$delta,attr(geomatrix,'dimensions')$y$delta*-1) plot(geomatrix) ee_upload(x = geomatrix,filename = paste0(filename,"geomatrix")) ee_geomatrix <- ee$Image(paste0(filename,"geomatrix")) geomatrix_stars <- ee_as_thumbnail(x = ee_geomatrix, scale = delta_geomatrix, vizparams = list(min = 0, max = 255)) geomatrix_stars[geomatrix_stars<=0]=NA names(geomatrix_stars) <- 'geomatrix.tif' plot(geomatrix_stars) #ee_manage_delete(filename) # Remove the folder created at the beginning nc <- st_read(system.file("shp/arequipa.shp", package="rgee")) nc_s <- suppressWarnings(st_simplify(nc, preserveTopology = TRUE, dTolerance = 0.05)) ee_upload(x = nc_s,filename = paste0(filename,"arequipa")) ee_monitoring() ee_manage_set_properties(path_asset = paste0(filename,"arequipa"), properties = list(message='hello-world',language = 'R')) }