Description Usage Arguments Details Value See Also Examples
Move results of an EE task saved in Google Drive to a local directory.
1 2 3 4 5 6 7 8 9 |
task |
List generated after finished correctly a EE task. See details. |
dsn |
Character. Output filename. If missing, a temporary file will be assigned. |
overwrite |
A boolean argument which indicates whether "filename" should be overwritten. By default TRUE. |
consider |
Interactive. See details. |
public |
Logical. If TRUE, a public link to the Google Drive resource is created. |
metadata |
Logical. If TRUE, export the metadata related to the Google Drive resource. See details. |
quiet |
logical. Suppress info message. |
The task argument needs a status as task "COMPLETED" to work, due that the
parameters necessary to identify EE objects into Google Drive are obtained
from ee$batch$Export$*$toDrive(...)$start()$status()
.
consider
argument is necessary due that Google Drive permits users to
create files with the same name. consider
uses an interactive R
session by default to help users identify just the files that they want to
download. Additionally, the options "last" and "all" are implemented. "last"
will download just the last file saved in Google Drive while with "all" all
files will be downloaded.
Finally if the argument metadata
is TRUE, a list with the
following elements are exported join with the output filename (dsn):
ee_id: Name of the Earth Engine task.
drive_name: Name of the Table in Google Drive.
drive_id: Id of the Table in Google Drive.
drive_download_link: Download link to the table.
If metadata
is FALSE will return the filename of the Google
Drive resource on their system. Otherwise, a list with two elements
(dns
and metadata
) is returned.
Other generic download functions:
ee_gcs_to_local()
1 2 3 4 5 6 7 8 9 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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | ## Not run:
library(rgee)
library(stars)
library(sf)
ee_users()
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()
# Get the mean annual NDVI for 2011
cloudMaskL457 <- function(image) {
qa <- image$select("pixel_qa")
cloud <- qa$bitwiseAnd(32L)$
And(qa$bitwiseAnd(128L))$
Or(qa$bitwiseAnd(8L))
mask2 <- image$mask()$reduce(ee$Reducer$min())
image <- image$updateMask(cloud$Not())$updateMask(mask2)
image$normalizedDifference(list("B4", "B3"))
}
ic_l5 <- ee$ImageCollection("LANDSAT/LT05/C01/T1_SR")$
filterBounds(ee$FeatureCollection(ee_ROI))$
filterDate("2011-01-01", "2011-12-31")$
map(cloudMaskL457)
# Create simple composite
mean_l5 <- ic_l5$mean()$rename("NDVI")
mean_l5 <- mean_l5$reproject(crs = "EPSG:4326", scale = 500)
mean_l5_Amarakaeri <- mean_l5$clip(ee_ROI)
# Move results from Earth Engine to Drive
task_img <- ee_image_to_drive(
image = mean_l5_Amarakaeri,
folder = "Amarakaeri",
fileFormat = "GEO_TIFF",
region = ee_ROI,
fileNamePrefix = "my_image_demo"
)
task_img$start()
ee_monitoring(task_img)
# Move results from Drive to local
img <- ee_drive_to_local(task = task_img)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.