# NOT RUN {
library(rgee)
ee_Initialize(drive = TRUE, gcs = TRUE)
ee_user_info()
# Define an image.
img <- ee$Image("LANDSAT/LC08/C01/T1_SR/LC08_038029_20180810")$
select(c("B4", "B3", "B2"))$
divide(10000)
# OPTIONAL display it using Map
Map$centerObject(eeObject = img)
Map$addLayer(eeObject = img, visParams = list(max = 0.4,gamma=0.1))
# Define an area of interest.
geometry <- ee$Geometry$Rectangle(
coords = c(-110.8, 44.6, -110.6, 44.7),
proj = "EPSG:4326",
geodesic = FALSE
)
## drive - Method 01
# Simple
img_02 <- ee_as_raster(
image = img,
region = geometry,
via = "drive"
)
# Lazy
img_02 <- ee_as_raster(
image = img,
region = geometry,
via = "drive",
lazy = TRUE
)
img_02_result <- img_02 %>% ee_utils_future_value()
img_02_result@history$metadata # metadata
# ## gcs - Method 02
# # Simple
# img_03 <- ee_as_raster(
# image = img,
# region = geometry,
# container = "rgee_dev",
# via = "gcs"
# )
#
# # Lazy
# img_03 <- ee_as_raster(
# image = img,
# region = geometry,
# container = "rgee_dev",
# lazy = TRUE,
# via = "gcs"
# )
#
# img_03_result <- img_03 %>% ee_utils_future_value()
# img_03_result@history$metadata # metadata
# OPTIONAL: clean containers
# ee_clean_container(name = "rgee_backup", type = "drive")
# ee_clean_container(name = "rgee_dev", type = "gcs")
# }
Run the code above in your browser using DataLab