Skip to contents

Dispatches to the appropriate retrieve_*() function for a given source id, so callers can retrieve any registered layer without knowing which underlying retrieval function backs it.

Usage

retrieve_source(source_id, refresh = FALSE, max_age = NULL)

Arguments

source_id

Character scalar. A source id from list_sources().

refresh

Logical. If TRUE, bypasses any cached copy and re-fetches from the live API. Defaults to FALSE.

max_age

Maximum cache age in days for registry-backed LIO sources. Defaults to NULL, which accepts any cached copy.

Value

An sf object, or a SpatRaster for raster sources (e.g. "synthetic_air_quality").

Examples

if (FALSE) { # \dontrun{
# Retrieves from the Ontario LIO REST service and caches the result.
phu <- retrieve_source("phu_boundaries")
} # }