Convert an ee$Image into a stars object
ee_as_stars( image, region = NULL, dsn = NULL, via = "getInfo", scale = NULL, maxPixels = 1e+09, container = "rgee_backup", quiet = FALSE, ... )
image | ee$Image to be converted into a stars object |
---|---|
region | EE Geometry (ee$Geometry$Polygon) which specify the region to export. CRS needs to be the same that the x argument otherwise it will be forced. If not specified image bounds will be taken. |
dsn | Character. Output filename. If missing,
|
via | Character. Method to fetch data about the object. Three methods are implemented: "getInfo", "drive", "gcs". See details. |
scale | Numeric. The resolution in meters per pixel. Defaults to the native resolution of the image asset. |
maxPixels | Numeric. The maximum allowed number of pixels in the exported image. The task will fail if the exported region covers more pixels in the specified projection. Defaults to 100,000,000. |
container | Character. Name of the folder ('drive') or bucket ('gcs')
to be exported into (ignored if |
quiet | Logical. Suppress info message |
... | Extra exporting argument. See ee_image_to_drive and ee_image_to_gcs. |
A stars-proxy object
ee_as_stars
supports the download of ee$Image
by three different options: "getInfo", "drive", and "gcs". When "getInfo"
is set in the via
argument, ee_as_stars
will make a
REST call to retrieve all the known information about the object. The
advantage of using "getInfo" is performing a quick download. However, there
is a limitation of 262144 pixels by request which makes it not recommendable
for large images. Instead of "getInfo", the options: "drive" and "gcs"
are suitable for large collections since they use an intermediate web store
service. Before using any of these options, it is necessary previously
to install the R packages
googledrive
and
googleCloudStorageR. For getting more information about exporting data from
Earth Engine, take a look at the
Google
Earth Engine Guide - Export data.
Other image download functions:
ee_as_raster()
,
ee_as_thumbnail()
,
ee_imagecollection_to_local()
if (FALSE) { 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 ) ## getInfo - Option 01 img_01 <- ee_as_stars( image = img, region = geometry, via = "getInfo" ) ## drive - Method 02 img_02 <- ee_as_stars( image = img, region = geometry, via = "drive" ) ## gcs - Method 03 # img_03 <- ee_as_stars( # image = img, # region = geometry, # container = "rgee_dev", # via = "gcs" #) # OPTIONAL: Delete containers # ee_clean_container(name = "rgee_backup", type = "drive") # ee_clean_container(name = "rgee_dev", type = "gcs") }