Description Usage Arguments Details Value Examples
Convert an Earth Engine (EE) image into a raster object
1 2 3 4 5 6 7 8 9 10 |
image |
ee$Image to be converted into a raster object |
region |
EE Geometry Rectangle (ee$Geometry$Rectangle). The 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. Multiple options supported. See details. |
scale |
Numeric. The resolution in meters per pixel. Defaults to the native resolution of the image assset. |
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 |
ee_as_raster
supports the download of ee$Image
by three different options: "getInfo", "drive", and "gcs". When "getInfo"
is set in the via
argument, ee_as_raster
will make an
REST call to retrieve all the known information about the object. The
advantage of use "getInfo" is a direct and faster 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 to use any of this options, it is necessary previously
install the R packages
googledrive
and
googleCloudStorageR. For getting more information about exporting data take
a look at the Google
Earth Engine Guide - Export data.
A RasterStack object
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)
# Initialize a specific Earth Engine account and load
# either Google Drive or Google Cloud Storage credentials
ee_reattach()
ee_Initialize(
email = "data.colec.fbf@gmail.com",
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_raster(
image = img,
region = geometry,
via = "getInfo"
)
## drive - Method 02
img_02 <- ee_as_raster(
image = img,
region = geometry,
via = "drive"
)
## gcs - Method 03
img_03 <- ee_as_raster(
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"
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.