stars_as_ee: Convert a local image into an EE Image

Description Usage Arguments Value Examples

View source: R/ee_image.R

Description

Convert a local image into an EE Image

Usage

1
2
3
4
5
6
7
8
stars_as_ee(
  x,
  assetId,
  overwrite = FALSE,
  monitoring = TRUE,
  bucket = NULL,
  quiet = FALSE
)

Arguments

x

stars or stars-proxy object to be converted into an ee$Image.

assetId

Character. Destination asset ID for the uploaded file.

overwrite

Logical. If TRUE, the assetId will be overwritten if it exists.

monitoring

Logical. If TRUE the exportation task will be monitored.

bucket

Character. Name of the GCS bucket.

quiet

Logical. Suppress info message.

Value

An ee$Image object

Examples

 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
## Not run: 
library(rgee)
library(stars)
ee_Initialize(gcs = TRUE)

# Get the filename of a image
tif <- system.file("tif/L7_ETMs.tif", package = "stars")
x <- read_stars(tif)
assetId <- sprintf("%s/%s",ee_get_assethome(),'stars_l7')

# Method 1
# 1. Move from local to gcs
gs_uri <- local_to_gcs(x = tif, bucket = 'rgee_dev')

# 2. Pass from gcs to asset
gcs_to_ee_image(
  x = x,
  gs_uri = gs_uri,
  assetId = assetId
)

# OPTIONAL: Monitoring progress
ee_monitoring()

# OPTIONAL: Display results
ee_stars_01 <- ee$Image(assetId)
Map$centerObject(ee_stars_01)
Map$addLayer(ee_stars_01)

# Method 2
ee_stars_02 <- stars_as_ee(
  x = x,
  assetId = assetId,
  bucket = "rgee_dev"
)
Map$centerObject(ee_stars_02)
Map$addLayer(ee_stars_02)

## End(Not run)

ryali93/rgee documentation built on May 13, 2020, 4:34 a.m.