Export an Earth Engine Image to Google Drive
export_drive.RdInitiates a task to export an ee.Image to the user's Google Drive.
Usage
export_drive(
image,
region,
scale,
crs = "EPSG:4326",
description = "gee_export",
folder = "GEE_Exports",
fileNamePrefix = description
)Arguments
- image
The `ee.Image` to export.
- region
The `ee.Geometry` or `ee.Feature` defining the export region.
- scale
The spatial resolution in meters.
- crs
The coordinate reference system as an EPSG string (e.g., 'EPSG:4326').
- description
A description for the export task. This will also be the default filename.
- folder
The folder in your Google Drive to save the export to.
- fileNamePrefix
The prefix for the exported file name.
Examples
if (FALSE) { # \dontrun{
# Initialize GEE
py_env_path <- "C:/Users/pulak/anaconda3/envs/maps/python.exe"
activate_rpygee(project_id = "spatialgeography", python_path = py_env_path)
# Define a Region of Interest using the Delhi asset
roi <- rgee::ee$FeatureCollection("projects/spatialgeography/assets/delhi")$geometry()
# --- Example 1: SRTM Digital Elevation Model ---
srtm <- rgee::ee$Image("CGIAR/SRTM90_V4")
export_drive(
image = srtm,
region = roi,
scale = 90,
description = "SRTM_Delhi_Export",
folder = "GEE_Exports"
)
# --- Example 2: Sentinel-2 Multispectral Image ---
s2 <- rgee::ee$ImageCollection("COPERNICUS/S2_SR")$
filterBounds(roi)$
filterDate("2023-01-01", "2023-01-31")$
first()
# Export specific bands (e.g., Red, Green, Blue, NIR)
s2_subset <- s2$select(c("B4", "B3", "B2", "B8"))
export_drive(
image = s2_subset,
region = roi,
scale = 10,
description = "Sentinel2_Demo_Export",
folder = "GEE_Exports"
)
} # }