Ir al contenido

Downloads an annual mode composite from Google Dynamic World. Creates a pixel-wise mode (most frequent class) composite for the specified year. Dynamic World provides near-real-time land use/land cover classification at 10m resolution.

Uso

download_dynamic_world_data(
  boundary_layer,
  iso3,
  gee_project,
  output_dir = here::here(),
  year = NULL,
  pus = NULL,
  aggregate_to_pus = FALSE,
  wait_time = 5,
  ...
)

Argumentos

boundary_layer

An sf object defining the spatial boundary of interest.

iso3

Character. Three-letter ISO country code for filename generation.

gee_project

Character. Google Earth Engine cloud project ID. This is required and must be a valid GEE project you have access to. Find your project ID in the GEE Code Editor.

output_dir

Character. Local output directory. Defaults to project root via here::here().

year

Numeric or NULL. Year for the annual composite. If NULL (default), uses the previous calendar year.

pus

SpatRaster or NULL. Planning units raster for GEE-side aggregation. When provided with aggregate_to_pus = TRUE, the export will be resampled to match the PU resolution and projection in GEE before download.

aggregate_to_pus

Logical. If TRUE and pus is provided, aggregate the data to planning unit resolution in GEE before export. This significantly speeds up processing by eliminating local resampling. Default is FALSE.

wait_time

Numeric. Maximum time in minutes to wait for the GEE export to appear in Google Drive. Default is 5. Increase for large exports.

...

Additional arguments passed to download_gee_layer().

Valor

A SpatRaster object of the downloaded Dynamic World data, or NULL if download failed.

Detalles

Google Dynamic World class values:

  • 0: Water

  • 1: Trees

  • 2: Grass

  • 3: Flooded vegetation

  • 4: Crops

  • 5: Shrub & Scrub

  • 6: Built Area

  • 7: Bare ground

  • 8: Snow & Ice

Use get_lulc_classes("dynamic_world") to retrieve these mappings programmatically.

Ejemplos

if (FALSE) { # \dontrun{
# Download Dynamic World annual composite for Ghana
dw_lulc <- download_dynamic_world_data(
  boundary_layer = ghana_boundary,
  iso3 = "GHA",
  gee_project = "my-gee-project",
  year = 2023
)

# Download with GEE-side aggregation to planning units
dw_lulc_agg <- download_dynamic_world_data(
  boundary_layer = ghana_boundary,
  iso3 = "GHA",
  gee_project = "my-gee-project",
  pus = planning_units,
  aggregate_to_pus = TRUE
)
} # }