Update WaPOR Metadata Cache from the Live API
Source:R/wapor_metadata_cache.R
wapor_update_metadata.RdRe-fetches dataset metadata from the FAO GISMGR API and writes JSON cache
files to dest. This is intended to be run periodically to keep the local
cache up to date when FAO adds new datasets.
Value
Invisibly, a named character vector of file paths that were written
(or would have been written). On network error the function warns and
returns NULL invisibly without overwriting existing files.
Details
API endpoints used:
L1/L2:
https://data.apps.fao.org/gismgr/api/v2/catalog/workspaces/WAPOR-3/mapsetsL3:
https://data.apps.fao.org/gismgr/api/v2/catalog/workspaces/WAPOR-3/mosaicsets
Pagination is handled automatically via the links[rel="next"] field in
each response.
Examples
if (FALSE) { # \dontrun{
# Update all levels in the default writable user cache
wapor_update_metadata()
# Update only L1 and write to a custom directory
wapor_update_metadata("L1", dest = tempdir())
} # }