Skip to contents

download_archive() is the core function used to downlaod archives from other specific functions.

Usage

download_archive(
  to_do,
  extension = c("gz", "zip", "7z"),
  name = NULL,
  date = NULL,
  version = NULL,
  verbose = FALSE
)

Arguments

to_do

data.frame. Four columns of character are expected, thow of which being mandatory. See details.

extension

character, vector of acceptable types of archive to be downloaded.

name

character, vector of acceptable names fo archive to be downloaded

date

character, something like a date that should be used as a filter.

version

character, something like a version that should be used as a filter.

verbose

logical, should the function send some messages while running.

Value

An invisible data.frame of log.

Details

download_archive() is used by other more specific functions. It takes as input a to_do data.frame giving correspondance between origin urls to local destinations. to_do is expected to contain those fields:

  • origin: the origin urls where to find archives.

  • destination: the local places where to save archives.

  • short: the name in short of what type of archives is being downloaded, used for log information. If missing, it is set to "unknown".

  • local_origin: the local origin for sites giving relative links, and for which it is different from origin. If missing, origin is used.

For each line of to_do, all archives that matches condition given by other parameters (extension, name, date, version) are downloaded.

Examples

if (FALSE) {
destination = tempdir()
to_do_cquest = data.frame(
 origin = "https://data.cquest.org/registre_parcellaire_graphique/2018",
 destination = destination,
 short = "rpg_cquest"
)
download_archive(to_do_cquest, version = "D976", verbose = TRUE)

to_do_ign = data.frame(
 origin = "https://geoservices.ign.fr/rpg",
 destination = destination,
 short = "rpg_ign"
)
download_archive(to_do_ign, version = "D976", date = "2020", verbose = TRUE)
download_archive(to_do_ign, version = "D976", verbose = TRUE)

to_do = rbind(to_do_cquest, to_do_ign)
download_archive(to_do, version = "D976", verbose = TRUE)
}